<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<title>API: menu   menu.js  (YUI Library)</title>

	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
	<link rel="stylesheet" type="text/css" href="assets/api.css" />

    <script type="text/javascript" src="assets/api-js"></script>
    <script type="text/javascript" src="assets/ac-js"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">
	<div id="hd">
        <h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
        <h3>Menu&nbsp; <span class="subtitle">2.9.0</span></h3>
        <a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> 
            &gt; <a href="./module_menu.html" title="menu">menu</a>
                
                 &gt; menu.js (source view) 
        <form onsubmit="return false">
            <div id="propertysearch">
                Search: <input autocomplete="off" id="searchinput" />
                <div id="searchresults">
                    &nbsp;
                </div>
            </div>
        </form>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
                <fieldset>
                    <legend>Filters</legend>
                <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
                <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
                <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
                </fieldset>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 .classopts { display:none; }
                        </style>
                        <div class="highlight"><pre><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">Lang</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">,</span>

    <span class="c1">// String constants</span>
    
        <span class="nx">_MENU</span> <span class="o">=</span> <span class="s2">&quot;Menu&quot;</span><span class="p">,</span>
        <span class="nx">_DIV_UPPERCASE</span> <span class="o">=</span> <span class="s2">&quot;DIV&quot;</span><span class="p">,</span>
        <span class="nx">_DIV_LOWERCASE</span> <span class="o">=</span> <span class="s2">&quot;div&quot;</span><span class="p">,</span>
        <span class="nx">_ID</span> <span class="o">=</span> <span class="s2">&quot;id&quot;</span><span class="p">,</span>
        <span class="nx">_SELECT</span> <span class="o">=</span> <span class="s2">&quot;SELECT&quot;</span><span class="p">,</span>
        <span class="nx">_XY</span> <span class="o">=</span> <span class="s2">&quot;xy&quot;</span><span class="p">,</span>
        <span class="nx">_Y</span> <span class="o">=</span> <span class="s2">&quot;y&quot;</span><span class="p">,</span>
        <span class="nx">_UL_UPPERCASE</span> <span class="o">=</span> <span class="s2">&quot;UL&quot;</span><span class="p">,</span>
        <span class="nx">_UL_LOWERCASE</span> <span class="o">=</span> <span class="s2">&quot;ul&quot;</span><span class="p">,</span>
        <span class="nx">_FIRST_OF_TYPE</span> <span class="o">=</span> <span class="s2">&quot;first-of-type&quot;</span><span class="p">,</span>
        <span class="nx">_LI</span> <span class="o">=</span> <span class="s2">&quot;LI&quot;</span><span class="p">,</span>
        <span class="nx">_OPTGROUP</span> <span class="o">=</span> <span class="s2">&quot;OPTGROUP&quot;</span><span class="p">,</span>
        <span class="nx">_OPTION</span> <span class="o">=</span> <span class="s2">&quot;OPTION&quot;</span><span class="p">,</span>
        <span class="nx">_DISABLED</span> <span class="o">=</span> <span class="s2">&quot;disabled&quot;</span><span class="p">,</span>
        <span class="nx">_NONE</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="p">,</span>
        <span class="nx">_SELECTED</span> <span class="o">=</span> <span class="s2">&quot;selected&quot;</span><span class="p">,</span>
        <span class="nx">_GROUP_INDEX</span> <span class="o">=</span> <span class="s2">&quot;groupindex&quot;</span><span class="p">,</span>
        <span class="nx">_INDEX</span> <span class="o">=</span> <span class="s2">&quot;index&quot;</span><span class="p">,</span>
        <span class="nx">_SUBMENU</span> <span class="o">=</span> <span class="s2">&quot;submenu&quot;</span><span class="p">,</span>
        <span class="nx">_VISIBLE</span> <span class="o">=</span> <span class="s2">&quot;visible&quot;</span><span class="p">,</span>
        <span class="nx">_HIDE_DELAY</span> <span class="o">=</span> <span class="s2">&quot;hidedelay&quot;</span><span class="p">,</span>
        <span class="nx">_POSITION</span> <span class="o">=</span> <span class="s2">&quot;position&quot;</span><span class="p">,</span>
        <span class="nx">_DYNAMIC</span> <span class="o">=</span> <span class="s2">&quot;dynamic&quot;</span><span class="p">,</span>
        <span class="nx">_STATIC</span> <span class="o">=</span> <span class="s2">&quot;static&quot;</span><span class="p">,</span>
        <span class="nx">_DYNAMIC_STATIC</span> <span class="o">=</span> <span class="nx">_DYNAMIC</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="nx">_STATIC</span><span class="p">,</span>
        <span class="nx">_URL</span> <span class="o">=</span> <span class="s2">&quot;url&quot;</span><span class="p">,</span>
        <span class="nx">_HASH</span> <span class="o">=</span> <span class="s2">&quot;#&quot;</span><span class="p">,</span>
        <span class="nx">_TARGET</span> <span class="o">=</span> <span class="s2">&quot;target&quot;</span><span class="p">,</span>
        <span class="nx">_MAX_HEIGHT</span> <span class="o">=</span> <span class="s2">&quot;maxheight&quot;</span><span class="p">,</span>
        <span class="nx">_TOP_SCROLLBAR</span> <span class="o">=</span> <span class="s2">&quot;topscrollbar&quot;</span><span class="p">,</span>
        <span class="nx">_BOTTOM_SCROLLBAR</span> <span class="o">=</span> <span class="s2">&quot;bottomscrollbar&quot;</span><span class="p">,</span>
        <span class="nx">_UNDERSCORE</span> <span class="o">=</span> <span class="s2">&quot;_&quot;</span><span class="p">,</span>
        <span class="nx">_TOP_SCROLLBAR_DISABLED</span> <span class="o">=</span> <span class="nx">_TOP_SCROLLBAR</span> <span class="o">+</span> <span class="nx">_UNDERSCORE</span> <span class="o">+</span> <span class="nx">_DISABLED</span><span class="p">,</span>
        <span class="nx">_BOTTOM_SCROLLBAR_DISABLED</span> <span class="o">=</span> <span class="nx">_BOTTOM_SCROLLBAR</span> <span class="o">+</span> <span class="nx">_UNDERSCORE</span> <span class="o">+</span> <span class="nx">_DISABLED</span><span class="p">,</span>
        <span class="nx">_MOUSEMOVE</span> <span class="o">=</span> <span class="s2">&quot;mousemove&quot;</span><span class="p">,</span>
        <span class="nx">_SHOW_DELAY</span> <span class="o">=</span> <span class="s2">&quot;showdelay&quot;</span><span class="p">,</span>
        <span class="nx">_SUBMENU_HIDE_DELAY</span> <span class="o">=</span> <span class="s2">&quot;submenuhidedelay&quot;</span><span class="p">,</span>
        <span class="nx">_IFRAME</span> <span class="o">=</span> <span class="s2">&quot;iframe&quot;</span><span class="p">,</span>
        <span class="nx">_CONSTRAIN_TO_VIEWPORT</span> <span class="o">=</span> <span class="s2">&quot;constraintoviewport&quot;</span><span class="p">,</span>
        <span class="nx">_PREVENT_CONTEXT_OVERLAP</span> <span class="o">=</span> <span class="s2">&quot;preventcontextoverlap&quot;</span><span class="p">,</span>
        <span class="nx">_SUBMENU_ALIGNMENT</span> <span class="o">=</span> <span class="s2">&quot;submenualignment&quot;</span><span class="p">,</span>
        <span class="nx">_AUTO_SUBMENU_DISPLAY</span> <span class="o">=</span> <span class="s2">&quot;autosubmenudisplay&quot;</span><span class="p">,</span>
        <span class="nx">_CLICK_TO_HIDE</span> <span class="o">=</span> <span class="s2">&quot;clicktohide&quot;</span><span class="p">,</span>
        <span class="nx">_CONTAINER</span> <span class="o">=</span> <span class="s2">&quot;container&quot;</span><span class="p">,</span>
        <span class="nx">_SCROLL_INCREMENT</span> <span class="o">=</span> <span class="s2">&quot;scrollincrement&quot;</span><span class="p">,</span>
        <span class="nx">_MIN_SCROLL_HEIGHT</span> <span class="o">=</span> <span class="s2">&quot;minscrollheight&quot;</span><span class="p">,</span>
        <span class="nx">_CLASSNAME</span> <span class="o">=</span> <span class="s2">&quot;classname&quot;</span><span class="p">,</span>
        <span class="nx">_SHADOW</span> <span class="o">=</span> <span class="s2">&quot;shadow&quot;</span><span class="p">,</span>
        <span class="nx">_KEEP_OPEN</span> <span class="o">=</span> <span class="s2">&quot;keepopen&quot;</span><span class="p">,</span>
        <span class="nx">_HD</span> <span class="o">=</span> <span class="s2">&quot;hd&quot;</span><span class="p">,</span>
        <span class="nx">_HAS_TITLE</span> <span class="o">=</span> <span class="s2">&quot;hastitle&quot;</span><span class="p">,</span>
        <span class="nx">_CONTEXT</span> <span class="o">=</span> <span class="s2">&quot;context&quot;</span><span class="p">,</span>
        <span class="nx">_EMPTY_STRING</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
        <span class="nx">_MOUSEDOWN</span> <span class="o">=</span> <span class="s2">&quot;mousedown&quot;</span><span class="p">,</span>
        <span class="nx">_KEYDOWN</span> <span class="o">=</span> <span class="s2">&quot;keydown&quot;</span><span class="p">,</span>
        <span class="nx">_HEIGHT</span> <span class="o">=</span> <span class="s2">&quot;height&quot;</span><span class="p">,</span>
        <span class="nx">_WIDTH</span> <span class="o">=</span> <span class="s2">&quot;width&quot;</span><span class="p">,</span>
        <span class="nx">_PX</span> <span class="o">=</span> <span class="s2">&quot;px&quot;</span><span class="p">,</span>
        <span class="nx">_EFFECT</span> <span class="o">=</span> <span class="s2">&quot;effect&quot;</span><span class="p">,</span>
        <span class="nx">_MONITOR_RESIZE</span> <span class="o">=</span> <span class="s2">&quot;monitorresize&quot;</span><span class="p">,</span>
        <span class="nx">_DISPLAY</span> <span class="o">=</span> <span class="s2">&quot;display&quot;</span><span class="p">,</span>
        <span class="nx">_BLOCK</span> <span class="o">=</span> <span class="s2">&quot;block&quot;</span><span class="p">,</span>
        <span class="nx">_VISIBILITY</span> <span class="o">=</span> <span class="s2">&quot;visibility&quot;</span><span class="p">,</span>
        <span class="nx">_ABSOLUTE</span> <span class="o">=</span> <span class="s2">&quot;absolute&quot;</span><span class="p">,</span>
        <span class="nx">_ZINDEX</span> <span class="o">=</span> <span class="s2">&quot;zindex&quot;</span><span class="p">,</span>
        <span class="nx">_YUI_MENU_BODY_SCROLLED</span> <span class="o">=</span> <span class="s2">&quot;yui-menu-body-scrolled&quot;</span><span class="p">,</span>
        <span class="nx">_NON_BREAKING_SPACE</span> <span class="o">=</span> <span class="s2">&quot;&amp;#32;&quot;</span><span class="p">,</span>
        <span class="nx">_SPACE</span> <span class="o">=</span> <span class="s2">&quot; &quot;</span><span class="p">,</span>
        <span class="nx">_MOUSEOVER</span> <span class="o">=</span> <span class="s2">&quot;mouseover&quot;</span><span class="p">,</span>
        <span class="nx">_MOUSEOUT</span> <span class="o">=</span> <span class="s2">&quot;mouseout&quot;</span><span class="p">,</span>
        <span class="nx">_ITEM_ADDED</span> <span class="o">=</span> <span class="s2">&quot;itemAdded&quot;</span><span class="p">,</span>
        <span class="nx">_ITEM_REMOVED</span> <span class="o">=</span> <span class="s2">&quot;itemRemoved&quot;</span><span class="p">,</span>
        <span class="nx">_HIDDEN</span> <span class="o">=</span> <span class="s2">&quot;hidden&quot;</span><span class="p">,</span>
        <span class="nx">_YUI_MENU_SHADOW</span> <span class="o">=</span> <span class="s2">&quot;yui-menu-shadow&quot;</span><span class="p">,</span>
        <span class="nx">_YUI_MENU_SHADOW_VISIBLE</span> <span class="o">=</span> <span class="nx">_YUI_MENU_SHADOW</span> <span class="o">+</span> <span class="s2">&quot;-visible&quot;</span><span class="p">,</span>
        <span class="nx">_YUI_MENU_SHADOW_YUI_MENU_SHADOW_VISIBLE</span> <span class="o">=</span> <span class="nx">_YUI_MENU_SHADOW</span> <span class="o">+</span> <span class="nx">_SPACE</span> <span class="o">+</span> <span class="nx">_YUI_MENU_SHADOW_VISIBLE</span><span class="p">;</span>


<span class="cm">/**</span>
<span class="cm">* The Menu class creates a container that holds a vertical list representing </span>
<span class="cm">* a set of options or commands.  Menu is the base class for all </span>
<span class="cm">* menu containers. </span>
<span class="cm">* @param {String} p_oElement String specifying the id attribute of the </span>
<span class="cm">* &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element of the menu.</span>
<span class="cm">* @param {String} p_oElement String specifying the id attribute of the </span>
<span class="cm">* &lt;code&gt;&amp;#60;select&amp;#62;&lt;/code&gt; element to be used as the data source </span>
<span class="cm">* for the menu.</span>
<span class="cm">* @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="cm">* level-one-html.html#ID-22445964&quot;&gt;HTMLDivElement&lt;/a&gt;} p_oElement Object </span>
<span class="cm">* specifying the &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element of the menu.</span>
<span class="cm">* @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="cm">* level-one-html.html#ID-94282980&quot;&gt;HTMLSelectElement&lt;/a&gt;} p_oElement </span>
<span class="cm">* Object specifying the &lt;code&gt;&amp;#60;select&amp;#62;&lt;/code&gt; element to be used as </span>
<span class="cm">* the data source for the menu.</span>
<span class="cm">* @param {Object} p_oConfig Optional. Object literal specifying the </span>
<span class="cm">* configuration for the menu. See configuration class documentation for </span>
<span class="cm">* more details.</span>
<span class="cm">* @namespace YAHOO.widget</span>
<span class="cm">* @class Menu</span>
<span class="cm">* @constructor</span>
<span class="cm">* @extends YAHOO.widget.Overlay</span>
<span class="cm">*/</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">Menu</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oElement</span><span class="p">,</span> <span class="nx">p_oConfig</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">p_oConfig</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">parent</span> <span class="o">=</span> <span class="nx">p_oConfig</span><span class="p">.</span><span class="nx">parent</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">lazyLoad</span> <span class="o">=</span> <span class="nx">p_oConfig</span><span class="p">.</span><span class="nx">lazyLoad</span> <span class="o">||</span> <span class="nx">p_oConfig</span><span class="p">.</span><span class="nx">lazyload</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">itemData</span> <span class="o">=</span> <span class="nx">p_oConfig</span><span class="p">.</span><span class="nx">itemData</span> <span class="o">||</span> <span class="nx">p_oConfig</span><span class="p">.</span><span class="nx">itemdata</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">constructor</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">p_oElement</span><span class="p">,</span> <span class="nx">p_oConfig</span><span class="p">);</span>
<span class="p">};</span>



<span class="cm">/**</span>
<span class="cm">* @method checkPosition</span>
<span class="cm">* @description Checks to make sure that the value of the &quot;position&quot; property </span>
<span class="cm">* is one of the supported strings. Returns true if the position is supported.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {Object} p_sPosition String specifying the position of the menu.</span>
<span class="cm">* @return {Boolean}</span>
<span class="cm">*/</span>
<span class="kd">function</span> <span class="nx">checkPosition</span><span class="p">(</span><span class="nx">p_sPosition</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">returnVal</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">p_sPosition</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">returnVal</span> <span class="o">=</span> <span class="p">(</span><span class="nx">_DYNAMIC_STATIC</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">((</span><span class="nx">p_sPosition</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">()))</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>

    <span class="p">}</span>

    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>

<span class="p">}</span>


<span class="kd">var</span> <span class="nx">Dom</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">,</span>
    <span class="nx">Event</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">,</span>
    <span class="nx">Module</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">Module</span><span class="p">,</span>
    <span class="nx">Overlay</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">Overlay</span><span class="p">,</span>
    <span class="nx">Menu</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">Menu</span><span class="p">,</span>
    <span class="nx">MenuManager</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuManager</span><span class="p">,</span>
    <span class="nx">CustomEvent</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">CustomEvent</span><span class="p">,</span>
    <span class="nx">UA</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">ua</span><span class="p">,</span>
    
    <span class="nx">m_oShadowTemplate</span><span class="p">,</span>

    <span class="nx">bFocusListenerInitialized</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>

    <span class="nx">oFocusedElement</span><span class="p">,</span>

    <span class="nx">EVENT_TYPES</span> <span class="o">=</span> <span class="p">[</span>
    
        <span class="p">[</span><span class="s2">&quot;mouseOverEvent&quot;</span><span class="p">,</span> <span class="nx">_MOUSEOVER</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;mouseOutEvent&quot;</span><span class="p">,</span> <span class="nx">_MOUSEOUT</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;mouseDownEvent&quot;</span><span class="p">,</span> <span class="nx">_MOUSEDOWN</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;mouseUpEvent&quot;</span><span class="p">,</span> <span class="s2">&quot;mouseup&quot;</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;clickEvent&quot;</span><span class="p">,</span> <span class="s2">&quot;click&quot;</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;keyPressEvent&quot;</span><span class="p">,</span> <span class="s2">&quot;keypress&quot;</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;keyDownEvent&quot;</span><span class="p">,</span> <span class="nx">_KEYDOWN</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;keyUpEvent&quot;</span><span class="p">,</span> <span class="s2">&quot;keyup&quot;</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;focusEvent&quot;</span><span class="p">,</span> <span class="s2">&quot;focus&quot;</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;blurEvent&quot;</span><span class="p">,</span> <span class="s2">&quot;blur&quot;</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;itemAddedEvent&quot;</span><span class="p">,</span> <span class="nx">_ITEM_ADDED</span><span class="p">],</span>
        <span class="p">[</span><span class="s2">&quot;itemRemovedEvent&quot;</span><span class="p">,</span> <span class="nx">_ITEM_REMOVED</span><span class="p">]</span>

    <span class="p">],</span>

    <span class="nx">VISIBLE_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_VISIBLE</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isBoolean</span>
    <span class="p">},</span> 

    <span class="nx">CONSTRAIN_TO_VIEWPORT_CONFIG</span> <span class="o">=</span>  <span class="p">{</span>
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_CONSTRAIN_TO_VIEWPORT</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isBoolean</span><span class="p">,</span> 
        <span class="nx">supercedes</span><span class="o">:</span> <span class="p">[</span><span class="nx">_IFRAME</span><span class="p">,</span><span class="s2">&quot;x&quot;</span><span class="p">,</span><span class="nx">_Y</span><span class="p">,</span><span class="nx">_XY</span><span class="p">]</span>
    <span class="p">},</span> 

    <span class="nx">PREVENT_CONTEXT_OVERLAP_CONFIG</span> <span class="o">=</span>  <span class="p">{</span>
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_PREVENT_CONTEXT_OVERLAP</span><span class="p">,</span>
        <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isBoolean</span><span class="p">,</span>  
        <span class="nx">supercedes</span><span class="o">:</span> <span class="p">[</span><span class="nx">_CONSTRAIN_TO_VIEWPORT</span><span class="p">]</span>
    <span class="p">},</span>

    <span class="nx">POSITION_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_POSITION</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="nx">_DYNAMIC</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">checkPosition</span><span class="p">,</span> 
        <span class="nx">supercedes</span><span class="o">:</span> <span class="p">[</span><span class="nx">_VISIBLE</span><span class="p">,</span> <span class="nx">_IFRAME</span><span class="p">]</span>
    <span class="p">},</span> 

    <span class="nx">SUBMENU_ALIGNMENT_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_SUBMENU_ALIGNMENT</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;tl&quot;</span><span class="p">,</span><span class="s2">&quot;tr&quot;</span><span class="p">]</span>
    <span class="p">},</span>

    <span class="nx">AUTO_SUBMENU_DISPLAY_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_AUTO_SUBMENU_DISPLAY</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isBoolean</span><span class="p">,</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span> 

    <span class="nx">SHOW_DELAY_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_SHOW_DELAY</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="mi">250</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">,</span> 
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span> 

    <span class="nx">HIDE_DELAY_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_HIDE_DELAY</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">,</span> 
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span> 

    <span class="nx">SUBMENU_HIDE_DELAY_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_SUBMENU_HIDE_DELAY</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="mi">250</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">,</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span> 

    <span class="nx">CLICK_TO_HIDE_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_CLICK_TO_HIDE</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isBoolean</span><span class="p">,</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span>

    <span class="nx">CONTAINER_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_CONTAINER</span><span class="p">,</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span> 

    <span class="nx">SCROLL_INCREMENT_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_SCROLL_INCREMENT</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">,</span>
        <span class="nx">supercedes</span><span class="o">:</span> <span class="p">[</span><span class="nx">_MAX_HEIGHT</span><span class="p">],</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span>

    <span class="nx">MIN_SCROLL_HEIGHT_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_MIN_SCROLL_HEIGHT</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="mi">90</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">,</span>
        <span class="nx">supercedes</span><span class="o">:</span> <span class="p">[</span><span class="nx">_MAX_HEIGHT</span><span class="p">],</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span>    

    <span class="nx">MAX_HEIGHT_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_MAX_HEIGHT</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">,</span>
        <span class="nx">supercedes</span><span class="o">:</span> <span class="p">[</span><span class="nx">_IFRAME</span><span class="p">],</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span> 

    <span class="nx">CLASS_NAME_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_CLASSNAME</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">,</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span> 

    <span class="nx">DISABLED_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_DISABLED</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isBoolean</span><span class="p">,</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
    <span class="p">},</span>
    
    <span class="nx">SHADOW_CONFIG</span> <span class="o">=</span>  <span class="p">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_SHADOW</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isBoolean</span><span class="p">,</span>
        <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
        <span class="nx">supercedes</span><span class="o">:</span> <span class="p">[</span><span class="nx">_VISIBLE</span><span class="p">]</span>
    <span class="p">},</span>
    
    <span class="nx">KEEP_OPEN_CONFIG</span> <span class="o">=</span> <span class="p">{</span>
        <span class="nx">key</span><span class="o">:</span> <span class="nx">_KEEP_OPEN</span><span class="p">,</span> 
        <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isBoolean</span>
    <span class="p">};</span>


<span class="kd">function</span> <span class="nx">onDocFocus</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>

    <span class="nx">oFocusedElement</span> <span class="o">=</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getTarget</span><span class="p">(</span><span class="nx">event</span><span class="p">);</span>

<span class="p">}</span>



<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">Menu</span><span class="p">,</span> <span class="nx">Overlay</span><span class="p">,</span> <span class="p">{</span>


<span class="c1">// Constants</span>


<span class="cm">/**</span>
<span class="cm">* @property CSS_CLASS_NAME</span>
<span class="cm">* @description String representing the CSS class(es) to be applied to the </span>
<span class="cm">* menu&#39;s &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element.</span>
<span class="cm">* @default &quot;yuimenu&quot;</span>
<span class="cm">* @final</span>
<span class="cm">* @type String</span>
<span class="cm">*/</span>
<span class="nx">CSS_CLASS_NAME</span><span class="o">:</span> <span class="s2">&quot;yuimenu&quot;</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property ITEM_TYPE</span>
<span class="cm">* @description Object representing the type of menu item to instantiate and </span>
<span class="cm">* add when parsing the child nodes (either &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; element, </span>
<span class="cm">* &lt;code&gt;&amp;#60;optgroup&amp;#62;&lt;/code&gt; element or &lt;code&gt;&amp;#60;option&amp;#62;&lt;/code&gt;) </span>
<span class="cm">* of the menu&#39;s source HTML element.</span>
<span class="cm">* @default YAHOO.widget.MenuItem</span>
<span class="cm">* @final</span>
<span class="cm">* @type YAHOO.widget.MenuItem</span>
<span class="cm">*/</span>
<span class="nx">ITEM_TYPE</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property GROUP_TITLE_TAG_NAME</span>
<span class="cm">* @description String representing the tagname of the HTML element used to </span>
<span class="cm">* title the menu&#39;s item groups.</span>
<span class="cm">* @default H6</span>
<span class="cm">* @final</span>
<span class="cm">* @type String</span>
<span class="cm">*/</span>
<span class="nx">GROUP_TITLE_TAG_NAME</span><span class="o">:</span> <span class="s2">&quot;h6&quot;</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property OFF_SCREEN_POSITION</span>
<span class="cm">* @description Array representing the default x and y position that a menu </span>
<span class="cm">* should have when it is positioned outside the viewport by the </span>
<span class="cm">* &quot;poistionOffScreen&quot; method.</span>
<span class="cm">* @default &quot;-999em&quot;</span>
<span class="cm">* @final</span>
<span class="cm">* @type String</span>
<span class="cm">*/</span>
<span class="nx">OFF_SCREEN_POSITION</span><span class="o">:</span> <span class="s2">&quot;-999em&quot;</span><span class="p">,</span>


<span class="c1">// Private properties</span>


<span class="cm">/** </span>
<span class="cm">* @property _useHideDelay</span>
<span class="cm">* @description Boolean indicating if the &quot;mouseover&quot; and &quot;mouseout&quot; event </span>
<span class="cm">* handlers used for hiding the menu via a call to &quot;YAHOO.lang.later&quot; have </span>
<span class="cm">* already been assigned.</span>
<span class="cm">* @default false</span>
<span class="cm">* @private</span>
<span class="cm">* @type Boolean</span>
<span class="cm">*/</span>
<span class="nx">_useHideDelay</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property _bHandledMouseOverEvent</span>
<span class="cm">* @description Boolean indicating the current state of the menu&#39;s </span>
<span class="cm">* &quot;mouseover&quot; event.</span>
<span class="cm">* @default false</span>
<span class="cm">* @private</span>
<span class="cm">* @type Boolean</span>
<span class="cm">*/</span>
<span class="nx">_bHandledMouseOverEvent</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property _bHandledMouseOutEvent</span>
<span class="cm">* @description Boolean indicating the current state of the menu&#39;s</span>
<span class="cm">* &quot;mouseout&quot; event.</span>
<span class="cm">* @default false</span>
<span class="cm">* @private</span>
<span class="cm">* @type Boolean</span>
<span class="cm">*/</span>
<span class="nx">_bHandledMouseOutEvent</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property _aGroupTitleElements</span>
<span class="cm">* @description Array of HTML element used to title groups of menu items.</span>
<span class="cm">* @default []</span>
<span class="cm">* @private</span>
<span class="cm">* @type Array</span>
<span class="cm">*/</span>
<span class="nx">_aGroupTitleElements</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property _aItemGroups</span>
<span class="cm">* @description Multi-dimensional Array representing the menu items as they</span>
<span class="cm">* are grouped in the menu.</span>
<span class="cm">* @default []</span>
<span class="cm">* @private</span>
<span class="cm">* @type Array</span>
<span class="cm">*/</span>
<span class="nx">_aItemGroups</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property _aListElements</span>
<span class="cm">* @description Array of &lt;code&gt;&amp;#60;ul&amp;#62;&lt;/code&gt; elements, each of which is </span>
<span class="cm">* the parent node for each item&#39;s &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; element.</span>
<span class="cm">* @default []</span>
<span class="cm">* @private</span>
<span class="cm">* @type Array</span>
<span class="cm">*/</span>
<span class="nx">_aListElements</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property _nCurrentMouseX</span>
<span class="cm">* @description The current x coordinate of the mouse inside the area of </span>
<span class="cm">* the menu.</span>
<span class="cm">* @default 0</span>
<span class="cm">* @private</span>
<span class="cm">* @type Number</span>
<span class="cm">*/</span>
<span class="nx">_nCurrentMouseX</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property _bStopMouseEventHandlers</span>
<span class="cm">* @description Stops &quot;mouseover,&quot; &quot;mouseout,&quot; and &quot;mousemove&quot; event handlers </span>
<span class="cm">* from executing.</span>
<span class="cm">* @default false</span>
<span class="cm">* @private</span>
<span class="cm">* @type Boolean</span>
<span class="cm">*/</span>
<span class="nx">_bStopMouseEventHandlers</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property _sClassName</span>
<span class="cm">* @description The current value of the &quot;classname&quot; configuration attribute.</span>
<span class="cm">* @default null</span>
<span class="cm">* @private</span>
<span class="cm">* @type String</span>
<span class="cm">*/</span>
<span class="nx">_sClassName</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>



<span class="c1">// Public properties</span>


<span class="cm">/**</span>
<span class="cm">* @property lazyLoad</span>
<span class="cm">* @description Boolean indicating if the menu&#39;s &quot;lazy load&quot; feature is </span>
<span class="cm">* enabled.  If set to &quot;true,&quot; initialization and rendering of the menu&#39;s </span>
<span class="cm">* items will be deferred until the first time it is made visible.  This </span>
<span class="cm">* property should be set via the constructor using the configuration </span>
<span class="cm">* object literal.</span>
<span class="cm">* @default false</span>
<span class="cm">* @type Boolean</span>
<span class="cm">*/</span>
<span class="nx">lazyLoad</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property itemData</span>
<span class="cm">* @description Array of items to be added to the menu.  The array can contain </span>
<span class="cm">* strings representing the text for each item to be created, object literals </span>
<span class="cm">* representing the menu item configuration properties, or MenuItem instances.  </span>
<span class="cm">* This property should be set via the constructor using the configuration </span>
<span class="cm">* object literal.</span>
<span class="cm">* @default null</span>
<span class="cm">* @type Array</span>
<span class="cm">*/</span>
<span class="nx">itemData</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property activeItem</span>
<span class="cm">* @description Object reference to the item in the menu that has is selected.</span>
<span class="cm">* @default null</span>
<span class="cm">* @type YAHOO.widget.MenuItem</span>
<span class="cm">*/</span>
<span class="nx">activeItem</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property parent</span>
<span class="cm">* @description Object reference to the menu&#39;s parent menu or menu item.  </span>
<span class="cm">* This property can be set via the constructor using the configuration </span>
<span class="cm">* object literal.</span>
<span class="cm">* @default null</span>
<span class="cm">* @type YAHOO.widget.MenuItem</span>
<span class="cm">*/</span>
<span class="nx">parent</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>


<span class="cm">/**</span>
<span class="cm">* @property srcElement</span>
<span class="cm">* @description Object reference to the HTML element (either </span>
<span class="cm">* &lt;code&gt;&amp;#60;select&amp;#62;&lt;/code&gt; or &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt;) used to </span>
<span class="cm">* create the menu.</span>
<span class="cm">* @default null</span>
<span class="cm">* @type &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="cm">* level-one-html.html#ID-94282980&quot;&gt;HTMLSelectElement&lt;/a&gt;|&lt;a </span>
<span class="cm">* href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.</span>
<span class="cm">* html#ID-22445964&quot;&gt;HTMLDivElement&lt;/a&gt;</span>
<span class="cm">*/</span>
<span class="nx">srcElement</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>



<span class="c1">// Events</span>


<span class="cm">/**</span>
<span class="cm">* @event mouseOverEvent</span>
<span class="cm">* @description Fires when the mouse has entered the menu.  Passes back </span>
<span class="cm">* the DOM Event object as an argument.</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event mouseOutEvent</span>
<span class="cm">* @description Fires when the mouse has left the menu.  Passes back the DOM </span>
<span class="cm">* Event object as an argument.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event mouseDownEvent</span>
<span class="cm">* @description Fires when the user mouses down on the menu.  Passes back the </span>
<span class="cm">* DOM Event object as an argument.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event mouseUpEvent</span>
<span class="cm">* @description Fires when the user releases a mouse button while the mouse is </span>
<span class="cm">* over the menu.  Passes back the DOM Event object as an argument.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event clickEvent</span>
<span class="cm">* @description Fires when the user clicks the on the menu.  Passes back the </span>
<span class="cm">* DOM Event object as an argument.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event keyPressEvent</span>
<span class="cm">* @description Fires when the user presses an alphanumeric key when one of the</span>
<span class="cm">* menu&#39;s items has focus.  Passes back the DOM Event object as an argument.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event keyDownEvent</span>
<span class="cm">* @description Fires when the user presses a key when one of the menu&#39;s items </span>
<span class="cm">* has focus.  Passes back the DOM Event object as an argument.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event keyUpEvent</span>
<span class="cm">* @description Fires when the user releases a key when one of the menu&#39;s items </span>
<span class="cm">* has focus.  Passes back the DOM Event object as an argument.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event itemAddedEvent</span>
<span class="cm">* @description Fires when an item is added to the menu.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @event itemRemovedEvent</span>
<span class="cm">* @description Fires when an item is removed to the menu.</span>
<span class="cm">* @type YAHOO.util.CustomEvent</span>
<span class="cm">*/</span>


<span class="cm">/**</span>
<span class="cm">* @method init</span>
<span class="cm">* @description The Menu class&#39;s initialization method. This method is </span>
<span class="cm">* automatically called by the constructor, and sets up all DOM references </span>
<span class="cm">* for pre-existing markup, and creates required markup if it is not </span>
<span class="cm">* already present.</span>
<span class="cm">* @param {String} p_oElement String specifying the id attribute of the </span>
<span class="cm">* &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element of the menu.</span>
<span class="cm">* @param {String} p_oElement String specifying the id attribute of the </span>
<span class="cm">* &lt;code&gt;&amp;#60;select&amp;#62;&lt;/code&gt; element to be used as the data source </span>
<span class="cm">* for the menu.</span>
<span class="cm">* @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="cm">* level-one-html.html#ID-22445964&quot;&gt;HTMLDivElement&lt;/a&gt;} p_oElement Object </span>
<span class="cm">* specifying the &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element of the menu.</span>
<span class="cm">* @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="cm">* level-one-html.html#ID-94282980&quot;&gt;HTMLSelectElement&lt;/a&gt;} p_oElement </span>
<span class="cm">* Object specifying the &lt;code&gt;&amp;#60;select&amp;#62;&lt;/code&gt; element to be used as </span>
<span class="cm">* the data source for the menu.</span>
<span class="cm">* @param {Object} p_oConfig Optional. Object literal specifying the </span>
<span class="cm">* configuration for the menu. See configuration class documentation for </span>
<span class="cm">* more details.</span>
<span class="cm">*/</span>
<span class="nx">init</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oElement</span><span class="p">,</span> <span class="nx">p_oConfig</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span> <span class="o">=</span> <span class="p">[];</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span> <span class="o">=</span> <span class="p">[];</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span> <span class="o">=</span> <span class="p">[];</span>

    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">ITEM_TYPE</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">ITEM_TYPE</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuItem</span><span class="p">;</span>

    <span class="p">}</span>


    <span class="kd">var</span> <span class="nx">oElement</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">p_oElement</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">oElement</span> <span class="o">=</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">p_oElement</span><span class="p">);</span>

    <span class="p">}</span>
    <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">p_oElement</span><span class="p">.</span><span class="nx">tagName</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oElement</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="p">;</span>

    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oElement</span> <span class="o">&amp;&amp;</span> <span class="nx">oElement</span><span class="p">.</span><span class="nx">tagName</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">switch</span><span class="p">(</span><span class="nx">oElement</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">())</span> <span class="p">{</span>
    
            <span class="k">case</span> <span class="nx">_DIV_UPPERCASE</span><span class="o">:</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">srcElement</span> <span class="o">=</span> <span class="nx">oElement</span><span class="p">;</span>

                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">oElement</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> <span class="p">{</span>

                    <span class="nx">oElement</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">_ID</span><span class="p">,</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">generateId</span><span class="p">());</span>

                <span class="p">}</span>


                <span class="cm">/* </span>
<span class="cm">                    Note: we don&#39;t pass the user config in here yet </span>
<span class="cm">                    because we only want it executed once, at the lowest </span>
<span class="cm">                    subclass level.</span>
<span class="cm">                */</span> 
            
                <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">init</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">oElement</span><span class="p">);</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">beforeInitEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">Menu</span><span class="p">);</span>

                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Source element: &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">srcElement</span><span class="p">.</span><span class="nx">tagName</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    
            <span class="k">break</span><span class="p">;</span>
    
            <span class="k">case</span> <span class="nx">_SELECT</span><span class="o">:</span>
    
                <span class="k">this</span><span class="p">.</span><span class="nx">srcElement</span> <span class="o">=</span> <span class="nx">oElement</span><span class="p">;</span>

    
                <span class="cm">/*</span>
<span class="cm">                    The source element is not something that we can use </span>
<span class="cm">                    outright, so we need to create a new Overlay</span>

<span class="cm">                    Note: we don&#39;t pass the user config in here yet </span>
<span class="cm">                    because we only want it executed once, at the lowest </span>
<span class="cm">                    subclass level.</span>
<span class="cm">                */</span> 

                <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">init</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">generateId</span><span class="p">());</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">beforeInitEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">Menu</span><span class="p">);</span>

                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Source element: &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">srcElement</span><span class="p">.</span><span class="nx">tagName</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

            <span class="k">break</span><span class="p">;</span>

        <span class="p">}</span>

    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>

        <span class="cm">/* </span>
<span class="cm">            Note: we don&#39;t pass the user config in here yet </span>
<span class="cm">            because we only want it executed once, at the lowest </span>
<span class="cm">            subclass level.</span>
<span class="cm">        */</span> 
    
        <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">init</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">p_oElement</span><span class="p">);</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">beforeInitEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">Menu</span><span class="p">);</span>

        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;No source element found.  Created element with id: &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">id</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">CSS_CLASS_NAME</span><span class="p">);</span>

        <span class="c1">// Subscribe to Custom Events</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">initEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onInit</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">beforeRenderEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onBeforeRender</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">renderEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onRender</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">beforeShowEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onBeforeShow</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">hideEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onHide</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">showEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onShow</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">beforeHideEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onBeforeHide</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">mouseOverEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onMouseOver</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">mouseOutEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onMouseOut</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">clickEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onClick</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">keyDownEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onKeyDown</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">keyPressEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onKeyPress</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">blurEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onBlur</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">bFocusListenerInitialized</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">Event</span><span class="p">.</span><span class="nx">onFocus</span><span class="p">(</span><span class="nb">document</span><span class="p">,</span> <span class="nx">onDocFocus</span><span class="p">);</span>
            <span class="nx">bFocusListenerInitialized</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="c1">//	Fixes an issue in Firefox 2 and Webkit where Dom&#39;s &quot;getX&quot; and &quot;getY&quot; </span>
        <span class="c1">//	methods return values that don&#39;t take scrollTop into consideration </span>

        <span class="k">if</span> <span class="p">((</span><span class="nx">UA</span><span class="p">.</span><span class="nx">gecko</span> <span class="o">&amp;&amp;</span> <span class="nx">UA</span><span class="p">.</span><span class="nx">gecko</span> <span class="o">&lt;</span> <span class="mf">1.9</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">UA</span><span class="p">.</span><span class="nx">webkit</span> <span class="o">&amp;&amp;</span> <span class="nx">UA</span><span class="p">.</span><span class="nx">webkit</span> <span class="o">&lt;</span> <span class="mi">523</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">subscribeToConfigEvent</span><span class="p">(</span><span class="nx">_Y</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_onYChange</span><span class="p">);</span>
        <span class="p">}</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">p_oConfig</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">applyConfig</span><span class="p">(</span><span class="nx">p_oConfig</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
        <span class="p">}</span>

        <span class="c1">// Register the Menu instance with the MenuManager</span>
        <span class="nx">MenuManager</span><span class="p">.</span><span class="nx">addMenu</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">initEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">Menu</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">},</span>



<span class="c1">// Private methods</span>


<span class="cm">/**</span>
<span class="cm">* @method _initSubTree</span>
<span class="cm">* @description Iterates the childNodes of the source element to find nodes </span>
<span class="cm">* used to instantiate menu and menu items.</span>
<span class="cm">* @private</span>
<span class="cm">*/</span>
<span class="nx">_initSubTree</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oSrcElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">srcElement</span><span class="p">,</span>
        <span class="nx">sSrcElementTagName</span><span class="p">,</span>
        <span class="nx">nGroup</span><span class="p">,</span>
        <span class="nx">sGroupTitleTagName</span><span class="p">,</span>
        <span class="nx">oNode</span><span class="p">,</span>
        <span class="nx">aListElements</span><span class="p">,</span>
        <span class="nx">nListElements</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oSrcElement</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="nx">sSrcElementTagName</span> <span class="o">=</span> 
            <span class="p">(</span><span class="nx">oSrcElement</span><span class="p">.</span><span class="nx">tagName</span> <span class="o">&amp;&amp;</span> <span class="nx">oSrcElement</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">());</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">sSrcElementTagName</span> <span class="o">==</span> <span class="nx">_DIV_UPPERCASE</span><span class="p">)</span> <span class="p">{</span>
    
            <span class="c1">//  Populate the collection of item groups and item group titles</span>
    
            <span class="nx">oNode</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">firstChild</span><span class="p">;</span>
    

            <span class="k">if</span> <span class="p">(</span><span class="nx">oNode</span><span class="p">)</span> <span class="p">{</span>
    
                <span class="nx">nGroup</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
                <span class="nx">sGroupTitleTagName</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">GROUP_TITLE_TAG_NAME</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">();</span>
        
                <span class="k">do</span> <span class="p">{</span>
        

                    <span class="k">if</span> <span class="p">(</span><span class="nx">oNode</span> <span class="o">&amp;&amp;</span> <span class="nx">oNode</span><span class="p">.</span><span class="nx">tagName</span><span class="p">)</span> <span class="p">{</span>
        
                        <span class="k">switch</span> <span class="p">(</span><span class="nx">oNode</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">())</span> <span class="p">{</span>
        
                            <span class="k">case</span> <span class="nx">sGroupTitleTagName</span><span class="o">:</span>
                            
                                <span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span><span class="p">[</span><span class="nx">nGroup</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oNode</span><span class="p">;</span>
        
                            <span class="k">break</span><span class="p">;</span>
        
                            <span class="k">case</span> <span class="nx">_UL_UPPERCASE</span><span class="o">:</span>
        
                                <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="nx">nGroup</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oNode</span><span class="p">;</span>
                                <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span><span class="p">[</span><span class="nx">nGroup</span><span class="p">]</span> <span class="o">=</span> <span class="p">[];</span>
                                <span class="nx">nGroup</span><span class="o">++</span><span class="p">;</span>
        
                            <span class="k">break</span><span class="p">;</span>
        
                        <span class="p">}</span>
                    
                    <span class="p">}</span>
        
                <span class="p">}</span>
                <span class="k">while</span> <span class="p">((</span><span class="nx">oNode</span> <span class="o">=</span> <span class="nx">oNode</span><span class="p">.</span><span class="nx">nextSibling</span><span class="p">));</span>
        
        
                <span class="cm">/*</span>
<span class="cm">                    Apply the &quot;first-of-type&quot; class to the first UL to mimic </span>
<span class="cm">                    the &quot;:first-of-type&quot; CSS3 psuedo class.</span>
<span class="cm">                */</span>
        
                <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="p">{</span>
        
                    <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nx">_FIRST_OF_TYPE</span><span class="p">);</span>
        
                <span class="p">}</span>
            
            <span class="p">}</span>
    
        <span class="p">}</span>
    
    
        <span class="nx">oNode</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
    
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Searching DOM for items to initialize.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    

        <span class="k">if</span> <span class="p">(</span><span class="nx">sSrcElementTagName</span><span class="p">)</span> <span class="p">{</span>
    
            <span class="k">switch</span> <span class="p">(</span><span class="nx">sSrcElementTagName</span><span class="p">)</span> <span class="p">{</span>
        
                <span class="k">case</span> <span class="nx">_DIV_UPPERCASE</span><span class="o">:</span>

                    <span class="nx">aListElements</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">;</span>
                    <span class="nx">nListElements</span> <span class="o">=</span> <span class="nx">aListElements</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
        
                    <span class="k">if</span> <span class="p">(</span><span class="nx">nListElements</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
        
                        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Found &quot;</span> <span class="o">+</span> <span class="nx">nListElements</span> <span class="o">+</span> <span class="s2">&quot; item groups to initialize.&quot;</span><span class="p">,</span> 
                                    <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        
                        <span class="nx">i</span> <span class="o">=</span> <span class="nx">nListElements</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>
        
                        <span class="k">do</span> <span class="p">{</span>
        
                            <span class="nx">oNode</span> <span class="o">=</span> <span class="nx">aListElements</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">firstChild</span><span class="p">;</span>
            
                            <span class="k">if</span> <span class="p">(</span><span class="nx">oNode</span><span class="p">)</span> <span class="p">{</span>

                                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Scanning &quot;</span> <span class="o">+</span> 
                                    <span class="nx">aListElements</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">childNodes</span><span class="p">.</span><span class="nx">length</span> <span class="o">+</span> 
                                    <span class="s2">&quot; child nodes for items to initialize.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            
                                <span class="k">do</span> <span class="p">{</span>
                
                                    <span class="k">if</span> <span class="p">(</span><span class="nx">oNode</span> <span class="o">&amp;&amp;</span> <span class="nx">oNode</span><span class="p">.</span><span class="nx">tagName</span> <span class="o">&amp;&amp;</span> 
                                        <span class="nx">oNode</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">()</span> <span class="o">==</span> <span class="nx">_LI</span><span class="p">)</span> <span class="p">{</span>
                
                                        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Initializing &quot;</span> <span class="o">+</span> 
                                            <span class="nx">oNode</span><span class="p">.</span><span class="nx">tagName</span> <span class="o">+</span> <span class="s2">&quot; node.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        
                                        <span class="k">this</span><span class="p">.</span><span class="nx">addItem</span><span class="p">(</span><span class="k">new</span> <span class="k">this</span><span class="p">.</span><span class="nx">ITEM_TYPE</span><span class="p">(</span><span class="nx">oNode</span><span class="p">,</span> 
                                                    <span class="p">{</span> <span class="nx">parent</span><span class="o">:</span> <span class="k">this</span> <span class="p">}),</span> <span class="nx">i</span><span class="p">);</span>
            
                                    <span class="p">}</span>
                        
                                <span class="p">}</span>
                                <span class="k">while</span> <span class="p">((</span><span class="nx">oNode</span> <span class="o">=</span> <span class="nx">oNode</span><span class="p">.</span><span class="nx">nextSibling</span><span class="p">));</span>
                            
                            <span class="p">}</span>
                    
                        <span class="p">}</span>
                        <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>
        
                    <span class="p">}</span>
        
                <span class="k">break</span><span class="p">;</span>
        
                <span class="k">case</span> <span class="nx">_SELECT</span><span class="o">:</span>
        
                    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Scanning &quot;</span> <span class="o">+</span>  
                        <span class="nx">oSrcElement</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">.</span><span class="nx">length</span> <span class="o">+</span> 
                        <span class="s2">&quot; child nodes for items to initialize.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        
                    <span class="nx">oNode</span> <span class="o">=</span> <span class="nx">oSrcElement</span><span class="p">.</span><span class="nx">firstChild</span><span class="p">;</span>
        
                    <span class="k">do</span> <span class="p">{</span>
        
                        <span class="k">if</span> <span class="p">(</span><span class="nx">oNode</span> <span class="o">&amp;&amp;</span> <span class="nx">oNode</span><span class="p">.</span><span class="nx">tagName</span><span class="p">)</span> <span class="p">{</span>
                        
                            <span class="k">switch</span> <span class="p">(</span><span class="nx">oNode</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">())</span> <span class="p">{</span>
            
                                <span class="k">case</span> <span class="nx">_OPTGROUP</span><span class="o">:</span>
                                <span class="k">case</span> <span class="nx">_OPTION</span><span class="o">:</span>
            
                                    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Initializing &quot;</span> <span class="o">+</span>  
                                        <span class="nx">oNode</span><span class="p">.</span><span class="nx">tagName</span> <span class="o">+</span> <span class="s2">&quot; node.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
            
                                    <span class="k">this</span><span class="p">.</span><span class="nx">addItem</span><span class="p">(</span>
                                            <span class="k">new</span> <span class="k">this</span><span class="p">.</span><span class="nx">ITEM_TYPE</span><span class="p">(</span>
                                                    <span class="nx">oNode</span><span class="p">,</span> 
                                                    <span class="p">{</span> <span class="nx">parent</span><span class="o">:</span> <span class="k">this</span> <span class="p">}</span>
                                                <span class="p">)</span>
                                            <span class="p">);</span>
            
                                <span class="k">break</span><span class="p">;</span>
            
                            <span class="p">}</span>
    
                        <span class="p">}</span>
        
                    <span class="p">}</span>
                    <span class="k">while</span> <span class="p">((</span><span class="nx">oNode</span> <span class="o">=</span> <span class="nx">oNode</span><span class="p">.</span><span class="nx">nextSibling</span><span class="p">));</span>
        
                <span class="k">break</span><span class="p">;</span>
        
            <span class="p">}</span>
    
        <span class="p">}</span>    
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _getFirstEnabledItem</span>
<span class="cm">* @description Returns the first enabled item in the menu.</span>
<span class="cm">* @return {YAHOO.widget.MenuItem}</span>
<span class="cm">* @private</span>
<span class="cm">*/</span>
<span class="nx">_getFirstEnabledItem</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">aItems</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItems</span><span class="p">(),</span>
        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span>
        <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">;</span>
    

    <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">nItems</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_DISABLED</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span> <span class="o">!=</span> <span class="nx">_NONE</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">;</span>
            <span class="k">break</span><span class="p">;</span>

        <span class="p">}</span>
    
    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>
    
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _addItemToGroup</span>
<span class="cm">* @description Adds a menu item to a group.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {Number} p_nGroupIndex Number indicating the group to which the </span>
<span class="cm">* item belongs.</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem </span>
<span class="cm">* instance to be added to the menu.</span>
<span class="cm">* @param {HTML} p_oItem String or markup specifying the content of the item to be added </span>
<span class="cm">* to the menu. The item is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.</span>
<span class="cm">* @param {Object} p_oItem Object literal containing a set of menu item </span>
<span class="cm">* configuration properties.</span>
<span class="cm">* @param {Number} p_nItemIndex Optional. Number indicating the index at </span>
<span class="cm">* which the menu item should be added.</span>
<span class="cm">* @return {YAHOO.widget.MenuItem}</span>
<span class="cm">*/</span>
<span class="nx">_addItemToGroup</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">,</span> <span class="nx">p_nItemIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">nGroupIndex</span><span class="p">,</span>
        <span class="nx">aGroup</span><span class="p">,</span>
        <span class="nx">oGroupItem</span><span class="p">,</span>
        <span class="nx">bAppend</span><span class="p">,</span>
        <span class="nx">oNextItemSibling</span><span class="p">,</span>
        <span class="nx">nItemIndex</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">;</span>


    <span class="kd">function</span> <span class="nx">getNextItemSibling</span><span class="p">(</span><span class="nx">p_aArray</span><span class="p">,</span> <span class="nx">p_nStartIndex</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">return</span> <span class="p">(</span><span class="nx">p_aArray</span><span class="p">[</span><span class="nx">p_nStartIndex</span><span class="p">]</span> <span class="o">||</span> <span class="nx">getNextItemSibling</span><span class="p">(</span><span class="nx">p_aArray</span><span class="p">,</span> <span class="p">(</span><span class="nx">p_nStartIndex</span><span class="o">+</span><span class="mi">1</span><span class="p">)));</span>

    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">p_oItem</span> <span class="k">instanceof</span> <span class="k">this</span><span class="p">.</span><span class="nx">ITEM_TYPE</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_oItem</span><span class="p">;</span>
        <span class="nx">oItem</span><span class="p">.</span><span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>

    <span class="p">}</span>
    <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">p_oItem</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">oItem</span> <span class="o">=</span> <span class="k">new</span> <span class="k">this</span><span class="p">.</span><span class="nx">ITEM_TYPE</span><span class="p">(</span><span class="nx">p_oItem</span><span class="p">,</span> <span class="p">{</span> <span class="nx">parent</span><span class="o">:</span> <span class="k">this</span> <span class="p">});</span>
    
    <span class="p">}</span>
    <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isObject</span><span class="p">(</span><span class="nx">p_oItem</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">p_oItem</span><span class="p">.</span><span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>

        <span class="nx">oItem</span> <span class="o">=</span> <span class="k">new</span> <span class="k">this</span><span class="p">.</span><span class="nx">ITEM_TYPE</span><span class="p">(</span><span class="nx">p_oItem</span><span class="p">.</span><span class="nx">text</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">);</span>

    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">))</span> <span class="p">{</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">;</span>
        
        <span class="p">}</span>


        <span class="nx">nGroupIndex</span> <span class="o">=</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="o">?</span> <span class="nx">p_nGroupIndex</span> <span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
        <span class="nx">aGroup</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_getItemGroup</span><span class="p">(</span><span class="nx">nGroupIndex</span><span class="p">);</span>



        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">aGroup</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">aGroup</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_createItemGroup</span><span class="p">(</span><span class="nx">nGroupIndex</span><span class="p">);</span>

        <span class="p">}</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">p_nItemIndex</span><span class="p">))</span> <span class="p">{</span>

            <span class="nx">bAppend</span> <span class="o">=</span> <span class="p">(</span><span class="nx">p_nItemIndex</span> <span class="o">&gt;=</span> <span class="nx">aGroup</span><span class="p">.</span><span class="nx">length</span><span class="p">);</span>            


            <span class="k">if</span> <span class="p">(</span><span class="nx">aGroup</span><span class="p">[</span><span class="nx">p_nItemIndex</span><span class="p">])</span> <span class="p">{</span>
    
                <span class="nx">aGroup</span><span class="p">.</span><span class="nx">splice</span><span class="p">(</span><span class="nx">p_nItemIndex</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">oItem</span><span class="p">);</span>
    
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
    
                <span class="nx">aGroup</span><span class="p">[</span><span class="nx">p_nItemIndex</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">;</span>
    
            <span class="p">}</span>


            <span class="nx">oGroupItem</span> <span class="o">=</span> <span class="nx">aGroup</span><span class="p">[</span><span class="nx">p_nItemIndex</span><span class="p">];</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oGroupItem</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">bAppend</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="o">!</span><span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">parentNode</span> <span class="o">||</span> 
                        <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">.</span><span class="nx">nodeType</span> <span class="o">==</span> <span class="mi">11</span><span class="p">))</span> <span class="p">{</span>
        
                    <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="nx">nGroupIndex</span><span class="p">].</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">);</span>
    
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
    
                    <span class="nx">oNextItemSibling</span> <span class="o">=</span> <span class="nx">getNextItemSibling</span><span class="p">(</span><span class="nx">aGroup</span><span class="p">,</span> <span class="p">(</span><span class="nx">p_nItemIndex</span><span class="o">+</span><span class="mi">1</span><span class="p">));</span>
    
                    <span class="k">if</span> <span class="p">(</span><span class="nx">oNextItemSibling</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="o">!</span><span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">parentNode</span> <span class="o">||</span> 
                            <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">.</span><span class="nx">nodeType</span> <span class="o">==</span> <span class="mi">11</span><span class="p">))</span> <span class="p">{</span>
            
                        <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="nx">nGroupIndex</span><span class="p">].</span><span class="nx">insertBefore</span><span class="p">(</span>
                                <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">oNextItemSibling</span><span class="p">.</span><span class="nx">element</span><span class="p">);</span>
        
                    <span class="p">}</span>
    
                <span class="p">}</span>
    

                <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
        
                <span class="k">this</span><span class="p">.</span><span class="nx">_subscribeToItemEvents</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">);</span>
    
                <span class="k">this</span><span class="p">.</span><span class="nx">_configureSubmenu</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">);</span>
                
                <span class="k">this</span><span class="p">.</span><span class="nx">_updateItemProperties</span><span class="p">(</span><span class="nx">nGroupIndex</span><span class="p">);</span>
        
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Item inserted.&quot;</span> <span class="o">+</span> 
                    <span class="s2">&quot; Text: &quot;</span> <span class="o">+</span> <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="s2">&quot;text&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;, &quot;</span> <span class="o">+</span> 
                    <span class="s2">&quot; Index: &quot;</span> <span class="o">+</span> <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">index</span> <span class="o">+</span> <span class="s2">&quot;, &quot;</span> <span class="o">+</span> 
                    <span class="s2">&quot; Group Index: &quot;</span> <span class="o">+</span> <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">groupIndex</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">itemAddedEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">);</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">changeContentEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>

                <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">oGroupItem</span><span class="p">;</span>
    
            <span class="p">}</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
    
            <span class="nx">nItemIndex</span> <span class="o">=</span> <span class="nx">aGroup</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
    
            <span class="nx">aGroup</span><span class="p">[</span><span class="nx">nItemIndex</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">;</span>

            <span class="nx">oGroupItem</span> <span class="o">=</span> <span class="nx">aGroup</span><span class="p">[</span><span class="nx">nItemIndex</span><span class="p">];</span>
    

            <span class="k">if</span> <span class="p">(</span><span class="nx">oGroupItem</span><span class="p">)</span> <span class="p">{</span>
    
                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="nx">nGroupIndex</span><span class="p">],</span> <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">))</span> <span class="p">{</span>
    
                    <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="nx">nGroupIndex</span><span class="p">].</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">);</span>
    
                <span class="p">}</span>
    
                <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">_GROUP_INDEX</span><span class="p">,</span> <span class="nx">nGroupIndex</span><span class="p">);</span>
                <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">_INDEX</span><span class="p">,</span> <span class="nx">nItemIndex</span><span class="p">);</span>
        
                <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
    
                <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">index</span> <span class="o">=</span> <span class="nx">nItemIndex</span><span class="p">;</span>
                <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">groupIndex</span> <span class="o">=</span> <span class="nx">nGroupIndex</span><span class="p">;</span>
        
                <span class="k">this</span><span class="p">.</span><span class="nx">_subscribeToItemEvents</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">);</span>
    
                <span class="k">this</span><span class="p">.</span><span class="nx">_configureSubmenu</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">);</span>
    
                <span class="k">if</span> <span class="p">(</span><span class="nx">nItemIndex</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
        
                    <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_FIRST_OF_TYPE</span><span class="p">);</span>
        
                <span class="p">}</span>

                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Item added.&quot;</span> <span class="o">+</span> 
                    <span class="s2">&quot; Text: &quot;</span> <span class="o">+</span> <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="s2">&quot;text&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;, &quot;</span> <span class="o">+</span> 
                    <span class="s2">&quot; Index: &quot;</span> <span class="o">+</span> <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">index</span> <span class="o">+</span> <span class="s2">&quot;, &quot;</span> <span class="o">+</span> 
                    <span class="s2">&quot; Group Index: &quot;</span> <span class="o">+</span> <span class="nx">oGroupItem</span><span class="p">.</span><span class="nx">groupIndex</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
        

                <span class="k">this</span><span class="p">.</span><span class="nx">itemAddedEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oGroupItem</span><span class="p">);</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">changeContentEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>

                <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">oGroupItem</span><span class="p">;</span>
    
            <span class="p">}</span>
    
        <span class="p">}</span>

    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>
    
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _removeItemFromGroupByIndex</span>
<span class="cm">* @description Removes a menu item from a group by index.  Returns the menu </span>
<span class="cm">* item that was removed.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {Number} p_nGroupIndex Number indicating the group to which the menu </span>
<span class="cm">* item belongs.</span>
<span class="cm">* @param {Number} p_nItemIndex Number indicating the index of the menu item </span>
<span class="cm">* to be removed.</span>
<span class="cm">* @return {YAHOO.widget.MenuItem}</span>
<span class="cm">*/</span>
<span class="nx">_removeItemFromGroupByIndex</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">p_nItemIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">nGroupIndex</span> <span class="o">=</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="o">?</span> <span class="nx">p_nGroupIndex</span> <span class="o">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="nx">aGroup</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_getItemGroup</span><span class="p">(</span><span class="nx">nGroupIndex</span><span class="p">),</span>
        <span class="nx">aArray</span><span class="p">,</span>
        <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">oUL</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">aGroup</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">aArray</span> <span class="o">=</span> <span class="nx">aGroup</span><span class="p">.</span><span class="nx">splice</span><span class="p">(</span><span class="nx">p_nItemIndex</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
        <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">aArray</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
    
        <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>
    
            <span class="c1">// Update the index and className properties of each member        </span>
            
            <span class="k">this</span><span class="p">.</span><span class="nx">_updateItemProperties</span><span class="p">(</span><span class="nx">nGroupIndex</span><span class="p">);</span>
    
            <span class="k">if</span> <span class="p">(</span><span class="nx">aGroup</span><span class="p">.</span><span class="nx">length</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
    
                <span class="c1">// Remove the UL</span>
    
                <span class="nx">oUL</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="nx">nGroupIndex</span><span class="p">];</span>
    
                <span class="k">if</span> <span class="p">(</span><span class="nx">oUL</span> <span class="o">&amp;&amp;</span> <span class="nx">oUL</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">oUL</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="nx">oUL</span><span class="p">);</span>
                <span class="p">}</span>
    
                <span class="c1">// Remove the group from the array of items</span>
    
                <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span><span class="p">.</span><span class="nx">splice</span><span class="p">(</span><span class="nx">nGroupIndex</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
    
    
                <span class="c1">// Remove the UL from the array of ULs</span>
    
                <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">.</span><span class="nx">splice</span><span class="p">(</span><span class="nx">nGroupIndex</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
    
    
                <span class="cm">/*</span>
<span class="cm">                     Assign the &quot;first-of-type&quot; class to the new first UL </span>
<span class="cm">                     in the collection</span>
<span class="cm">                */</span>
    
                <span class="nx">oUL</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
    
                <span class="k">if</span> <span class="p">(</span><span class="nx">oUL</span><span class="p">)</span> <span class="p">{</span>
    
                    <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">oUL</span><span class="p">,</span> <span class="nx">_FIRST_OF_TYPE</span><span class="p">);</span>
    
                <span class="p">}</span>            
    
            <span class="p">}</span>
    

            <span class="k">this</span><span class="p">.</span><span class="nx">itemRemovedEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="nx">oItem</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">changeContentEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>
    
        <span class="p">}</span>

    <span class="p">}</span>

    <span class="c1">// Return a reference to the item that was removed</span>

    <span class="k">return</span> <span class="nx">oItem</span><span class="p">;</span>
    
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _removeItemFromGroupByValue</span>
<span class="cm">* @description Removes a menu item from a group by reference.  Returns the </span>
<span class="cm">* menu item that was removed.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {Number} p_nGroupIndex Number indicating the group to which the</span>
<span class="cm">* menu item belongs.</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem </span>
<span class="cm">* instance to be removed.</span>
<span class="cm">* @return {YAHOO.widget.MenuItem}</span>
<span class="cm">*/</span>    
<span class="nx">_removeItemFromGroupByValue</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">aGroup</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_getItemGroup</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">),</span>
        <span class="nx">nItems</span><span class="p">,</span>
        <span class="nx">nItemIndex</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">aGroup</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aGroup</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
        <span class="nx">nItemIndex</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
    
        <span class="k">if</span> <span class="p">(</span><span class="nx">nItems</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
    
            <span class="nx">i</span> <span class="o">=</span> <span class="nx">nItems</span><span class="o">-</span><span class="mi">1</span><span class="p">;</span>
        
            <span class="k">do</span> <span class="p">{</span>
        
                <span class="k">if</span> <span class="p">(</span><span class="nx">aGroup</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">==</span> <span class="nx">p_oItem</span><span class="p">)</span> <span class="p">{</span>
        
                    <span class="nx">nItemIndex</span> <span class="o">=</span> <span class="nx">i</span><span class="p">;</span>
                    <span class="k">break</span><span class="p">;</span>    
        
                <span class="p">}</span>
        
            <span class="p">}</span>
            <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>
        
            <span class="k">if</span> <span class="p">(</span><span class="nx">nItemIndex</span> <span class="o">&gt;</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
        
                <span class="nx">returnVal</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_removeItemFromGroupByIndex</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">nItemIndex</span><span class="p">);</span>
        
            <span class="p">}</span>
    
        <span class="p">}</span>
    
    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _updateItemProperties</span>
<span class="cm">* @description Updates the &quot;index,&quot; &quot;groupindex,&quot; and &quot;className&quot; properties </span>
<span class="cm">* of the menu items in the specified group. </span>
<span class="cm">* @private</span>
<span class="cm">* @param {Number} p_nGroupIndex Number indicating the group of items to update.</span>
<span class="cm">*/</span>
<span class="nx">_updateItemProperties</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">aGroup</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_getItemGroup</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">),</span>
        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aGroup</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span>
        <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">oLI</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">nItems</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">i</span> <span class="o">=</span> <span class="nx">nItems</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>

        <span class="c1">// Update the index and className properties of each member</span>
    
        <span class="k">do</span> <span class="p">{</span>

            <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">aGroup</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>
    
                <span class="nx">oLI</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">element</span><span class="p">;</span>

                <span class="nx">oItem</span><span class="p">.</span><span class="nx">index</span> <span class="o">=</span> <span class="nx">i</span><span class="p">;</span>
                <span class="nx">oItem</span><span class="p">.</span><span class="nx">groupIndex</span> <span class="o">=</span> <span class="nx">p_nGroupIndex</span><span class="p">;</span>

                <span class="nx">oLI</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">_GROUP_INDEX</span><span class="p">,</span> <span class="nx">p_nGroupIndex</span><span class="p">);</span>
                <span class="nx">oLI</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">_INDEX</span><span class="p">,</span> <span class="nx">i</span><span class="p">);</span>

                <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="nx">oLI</span><span class="p">,</span> <span class="nx">_FIRST_OF_TYPE</span><span class="p">);</span>

            <span class="p">}</span>
    
        <span class="p">}</span>
        <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">oLI</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">oLI</span><span class="p">,</span> <span class="nx">_FIRST_OF_TYPE</span><span class="p">);</span>

        <span class="p">}</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _createItemGroup</span>
<span class="cm">* @description Creates a new menu item group (array) and its associated </span>
<span class="cm">* &lt;code&gt;&amp;#60;ul&amp;#62;&lt;/code&gt; element. Returns an aray of menu item groups.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {Number} p_nIndex Number indicating the group to create.</span>
<span class="cm">* @return {Array}</span>
<span class="cm">*/</span>
<span class="nx">_createItemGroup</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_nIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oUL</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span><span class="p">[</span><span class="nx">p_nIndex</span><span class="p">])</span> <span class="p">{</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span><span class="p">[</span><span class="nx">p_nIndex</span><span class="p">]</span> <span class="o">=</span> <span class="p">[];</span>

        <span class="nx">oUL</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="nx">_UL_LOWERCASE</span><span class="p">);</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="nx">p_nIndex</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oUL</span><span class="p">;</span>

        <span class="nx">returnVal</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span><span class="p">[</span><span class="nx">p_nIndex</span><span class="p">];</span>

    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _getItemGroup</span>
<span class="cm">* @description Returns the menu item group at the specified index.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {Number} p_nIndex Number indicating the index of the menu item group </span>
<span class="cm">* to be retrieved.</span>
<span class="cm">* @return {Array}</span>
<span class="cm">*/</span>
<span class="nx">_getItemGroup</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_nIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">nIndex</span> <span class="o">=</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">p_nIndex</span><span class="p">)</span> <span class="o">?</span> <span class="nx">p_nIndex</span> <span class="o">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="nx">aGroups</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">nIndex</span> <span class="k">in</span> <span class="nx">aGroups</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">aGroups</span><span class="p">[</span><span class="nx">nIndex</span><span class="p">];</span>

    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _configureSubmenu</span>
<span class="cm">* @description Subscribes the menu item&#39;s submenu to its parent menu&#39;s events.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem </span>
<span class="cm">* instance with the submenu to be configured.</span>
<span class="cm">*/</span>
<span class="nx">_configureSubmenu</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oItem</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">p_oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
            
        <span class="cm">/*</span>
<span class="cm">            Listen for configuration changes to the parent menu </span>
<span class="cm">            so they they can be applied to the submenu.</span>
<span class="cm">        */</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">configChangedEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onParentMenuConfigChange</span><span class="p">,</span> <span class="nx">oSubmenu</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">renderEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onParentMenuRender</span><span class="p">,</span> <span class="nx">oSubmenu</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>

    <span class="p">}</span>

<span class="p">},</span>




<span class="cm">/**</span>
<span class="cm">* @method _subscribeToItemEvents</span>
<span class="cm">* @description Subscribes a menu to a menu item&#39;s event.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem </span>
<span class="cm">* instance whose events should be subscribed to.</span>
<span class="cm">*/</span>
<span class="nx">_subscribeToItemEvents</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oItem</span><span class="p">)</span> <span class="p">{</span>

    <span class="nx">p_oItem</span><span class="p">.</span><span class="nx">destroyEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onMenuItemDestroy</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
    <span class="nx">p_oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">configChangedEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onMenuItemConfigChange</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onVisibleChange</span>
<span class="cm">* @description Change event handler for the the menu&#39;s &quot;visible&quot; configuration</span>
<span class="cm">* property.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onVisibleChange</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">bVisible</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
    
    <span class="k">if</span> <span class="p">(</span><span class="nx">bVisible</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_VISIBLE</span><span class="p">);</span>

    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_VISIBLE</span><span class="p">);</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _cancelHideDelay</span>
<span class="cm">* @description Cancels the call to &quot;hideMenu.&quot;</span>
<span class="cm">* @private</span>
<span class="cm">*/</span>
<span class="nx">_cancelHideDelay</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oTimer</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">().</span><span class="nx">_hideDelayTimer</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">oTimer</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oTimer</span><span class="p">.</span><span class="nx">cancel</span><span class="p">();</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _execHideDelay</span>
<span class="cm">* @description Hides the menu after the number of milliseconds specified by </span>
<span class="cm">* the &quot;hidedelay&quot; configuration property.</span>
<span class="cm">* @private</span>
<span class="cm">*/</span>
<span class="nx">_execHideDelay</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">_cancelHideDelay</span><span class="p">();</span>

    <span class="kd">var</span> <span class="nx">oRoot</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">();</span>

    <span class="nx">oRoot</span><span class="p">.</span><span class="nx">_hideDelayTimer</span> <span class="o">=</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">later</span><span class="p">(</span><span class="nx">oRoot</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_HIDE_DELAY</span><span class="p">),</span> <span class="k">this</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
    
        <span class="k">if</span> <span class="p">(</span><span class="nx">oRoot</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">oRoot</span><span class="p">.</span><span class="nx">hasFocus</span><span class="p">())</span> <span class="p">{</span>
                <span class="nx">oRoot</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
            <span class="p">}</span>
            <span class="nx">oRoot</span><span class="p">.</span><span class="nx">clearActiveItem</span><span class="p">();</span>
        <span class="p">}</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">oRoot</span> <span class="o">==</span> <span class="k">this</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="p">(</span><span class="k">this</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span><span class="p">)</span> <span class="o">&amp;&amp;</span> 
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>
        <span class="p">}</span>
    <span class="p">});</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _cancelShowDelay</span>
<span class="cm">* @description Cancels the call to the &quot;showMenu.&quot;</span>
<span class="cm">* @private</span>
<span class="cm">*/</span>
<span class="nx">_cancelShowDelay</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">oTimer</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">().</span><span class="nx">_showDelayTimer</span><span class="p">;</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">oTimer</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">oTimer</span><span class="p">.</span><span class="nx">cancel</span><span class="p">();</span>
    <span class="p">}</span>
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _execSubmenuHideDelay</span>
<span class="cm">* @description Hides a submenu after the number of milliseconds specified by </span>
<span class="cm">* the &quot;submenuhidedelay&quot; configuration property have elapsed.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oSubmenu Object specifying the submenu that  </span>
<span class="cm">* should be hidden.</span>
<span class="cm">* @param {Number} p_nMouseX The x coordinate of the mouse when it left </span>
<span class="cm">* the specified submenu&#39;s parent menu item.</span>
<span class="cm">* @param {Number} p_nHideDelay The number of milliseconds that should ellapse</span>
<span class="cm">* before the submenu is hidden.</span>
<span class="cm">*/</span>
<span class="nx">_execSubmenuHideDelay</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oSubmenu</span><span class="p">,</span> <span class="nx">p_nMouseX</span><span class="p">,</span> <span class="nx">p_nHideDelay</span><span class="p">)</span> <span class="p">{</span>

    <span class="nx">p_oSubmenu</span><span class="p">.</span><span class="nx">_submenuHideDelayTimer</span> <span class="o">=</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">later</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_nCurrentMouseX</span> <span class="o">&gt;</span> <span class="p">(</span><span class="nx">p_nMouseX</span> <span class="o">+</span> <span class="mi">10</span><span class="p">))</span> <span class="p">{</span>

            <span class="nx">p_oSubmenu</span><span class="p">.</span><span class="nx">_submenuHideDelayTimer</span> <span class="o">=</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">later</span><span class="p">(</span><span class="nx">p_nHideDelay</span><span class="p">,</span> <span class="nx">p_oSubmenu</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
        
                <span class="k">this</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>

            <span class="p">});</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="nx">p_oSubmenu</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>
        
        <span class="p">}</span>
    
    <span class="p">});</span>

<span class="p">},</span>



<span class="c1">// Protected methods</span>


<span class="cm">/**</span>
<span class="cm">* @method _disableScrollHeader</span>
<span class="cm">* @description Disables the header used for scrolling the body of the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">*/</span>
<span class="nx">_disableScrollHeader</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_bHeaderDisabled</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">header</span><span class="p">,</span> <span class="nx">_TOP_SCROLLBAR_DISABLED</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_bHeaderDisabled</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _disableScrollFooter</span>
<span class="cm">* @description Disables the footer used for scrolling the body of the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">*/</span>
<span class="nx">_disableScrollFooter</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_bFooterDisabled</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">footer</span><span class="p">,</span> <span class="nx">_BOTTOM_SCROLLBAR_DISABLED</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_bFooterDisabled</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _enableScrollHeader</span>
<span class="cm">* @description Enables the header used for scrolling the body of the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">*/</span>
<span class="nx">_enableScrollHeader</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_bHeaderDisabled</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">header</span><span class="p">,</span> <span class="nx">_TOP_SCROLLBAR_DISABLED</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_bHeaderDisabled</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _enableScrollFooter</span>
<span class="cm">* @description Enables the footer used for scrolling the body of the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">*/</span>
<span class="nx">_enableScrollFooter</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_bFooterDisabled</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">footer</span><span class="p">,</span> <span class="nx">_BOTTOM_SCROLLBAR_DISABLED</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_bFooterDisabled</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onMouseOver</span>
<span class="cm">* @description &quot;mouseover&quot; event handler for the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onMouseOver</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oEvent</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
        <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span>
        <span class="nx">oTarget</span> <span class="o">=</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getTarget</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">),</span>
        <span class="nx">oRoot</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">(),</span>
        <span class="nx">oSubmenuHideDelayTimer</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_submenuHideDelayTimer</span><span class="p">,</span>
        <span class="nx">oParentMenu</span><span class="p">,</span>
        <span class="nx">nShowDelay</span><span class="p">,</span>
        <span class="nx">bShowDelay</span><span class="p">,</span>
        <span class="nx">oActiveItem</span><span class="p">,</span>
        <span class="nx">oItemCfg</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">;</span>


    <span class="kd">var</span> <span class="nx">showSubmenu</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">))</span> <span class="p">{</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">show</span><span class="p">();</span>

        <span class="p">}</span>

    <span class="p">};</span>


    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_bStopMouseEventHandlers</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_bHandledMouseOverEvent</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">oTarget</span> <span class="o">==</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span> <span class="o">||</span> 
                <span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">oTarget</span><span class="p">)))</span> <span class="p">{</span>
    
            <span class="c1">// Menu mouseover logic</span>

            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_useHideDelay</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_cancelHideDelay</span><span class="p">();</span>
            <span class="p">}</span>
    
            <span class="k">this</span><span class="p">.</span><span class="nx">_nCurrentMouseX</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
    
            <span class="nx">Event</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_MOUSEMOVE</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_onMouseMove</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>


            <span class="cm">/*</span>
<span class="cm">                If the mouse is moving from the submenu back to its corresponding menu item, </span>
<span class="cm">                don&#39;t hide the submenu or clear the active MenuItem.</span>
<span class="cm">            */</span>

            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="nx">oItem</span> <span class="o">&amp;&amp;</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getRelatedTarget</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">))))</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">clearActiveItem</span><span class="p">();</span>

            <span class="p">}</span>
    

            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">parent</span> <span class="o">&amp;&amp;</span> <span class="nx">oSubmenuHideDelayTimer</span><span class="p">)</span> <span class="p">{</span>
    
                <span class="nx">oSubmenuHideDelayTimer</span><span class="p">.</span><span class="nx">cancel</span><span class="p">();</span>
    
                <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    
                <span class="nx">oParentMenu</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">parent</span><span class="p">;</span>
    
                <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">_bHandledMouseOutEvent</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
                <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">_bHandledMouseOverEvent</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
    
            <span class="p">}</span>
    
    
            <span class="k">this</span><span class="p">.</span><span class="nx">_bHandledMouseOverEvent</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_bHandledMouseOutEvent</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
        
        <span class="p">}</span>
    
    
        <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">handledMouseOverEvent</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_DISABLED</span><span class="p">)</span> <span class="o">&amp;&amp;</span> 
            <span class="p">(</span><span class="nx">oTarget</span> <span class="o">==</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">element</span> <span class="o">||</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">oTarget</span><span class="p">)))</span> <span class="p">{</span>
    
            <span class="c1">// Menu Item mouseover logic</span>
    
            <span class="nx">nShowDelay</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SHOW_DELAY</span><span class="p">);</span>
            <span class="nx">bShowDelay</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nShowDelay</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">);</span>
    
    
            <span class="k">if</span> <span class="p">(</span><span class="nx">bShowDelay</span><span class="p">)</span> <span class="p">{</span>
            
                <span class="k">this</span><span class="p">.</span><span class="nx">_cancelShowDelay</span><span class="p">();</span>
            
            <span class="p">}</span>
    
    
            <span class="nx">oActiveItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">;</span>
        
            <span class="k">if</span> <span class="p">(</span><span class="nx">oActiveItem</span><span class="p">)</span> <span class="p">{</span>
        
                <span class="nx">oActiveItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
        
            <span class="p">}</span>
    
    
            <span class="nx">oItemCfg</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">;</span>
        
            <span class="c1">// Select and focus the current menu item</span>
        
            <span class="nx">oItemCfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    
    
            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">hasFocus</span><span class="p">()</span> <span class="o">||</span> <span class="nx">oRoot</span><span class="p">.</span><span class="nx">_hasFocus</span><span class="p">)</span> <span class="p">{</span>
            
                <span class="nx">oItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
                
                <span class="nx">oRoot</span><span class="p">.</span><span class="nx">_hasFocus</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
            
            <span class="p">}</span>
    
    
            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_AUTO_SUBMENU_DISPLAY</span><span class="p">))</span> <span class="p">{</span>
    
                <span class="c1">// Show the submenu this menu item</span>
    
                <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItemCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
            
                <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
            
                    <span class="k">if</span> <span class="p">(</span><span class="nx">bShowDelay</span><span class="p">)</span> <span class="p">{</span>
    
                        <span class="nx">oRoot</span><span class="p">.</span><span class="nx">_showDelayTimer</span> <span class="o">=</span> 
                            <span class="nx">Lang</span><span class="p">.</span><span class="nx">later</span><span class="p">(</span><span class="nx">oRoot</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SHOW_DELAY</span><span class="p">),</span> <span class="nx">oSubmenu</span><span class="p">,</span> <span class="nx">showSubmenu</span><span class="p">);</span>
            
                    <span class="p">}</span>
                    <span class="k">else</span> <span class="p">{</span>
    
                        <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">show</span><span class="p">();</span>
    
                    <span class="p">}</span>
    
                <span class="p">}</span>
    
            <span class="p">}</span>                        
    
            <span class="nx">oItem</span><span class="p">.</span><span class="nx">handledMouseOverEvent</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
            <span class="nx">oItem</span><span class="p">.</span><span class="nx">handledMouseOutEvent</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
    
        <span class="p">}</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onMouseOut</span>
<span class="cm">* @description &quot;mouseout&quot; event handler for the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onMouseOut</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oEvent</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
        <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span>
        <span class="nx">oRelatedTarget</span> <span class="o">=</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getRelatedTarget</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">),</span>
        <span class="nx">bMovingToSubmenu</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
        <span class="nx">oItemCfg</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">,</span>
        <span class="nx">nSubmenuHideDelay</span><span class="p">,</span>
        <span class="nx">nShowDelay</span><span class="p">;</span>


    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;onMouseout: this == &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">);</span>

    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_bStopMouseEventHandlers</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_DISABLED</span><span class="p">))</span> <span class="p">{</span>
    
            <span class="nx">oItemCfg</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">;</span>
            <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItemCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
    
    
            <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">oRelatedTarget</span> <span class="o">==</span> <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">element</span> <span class="o">||</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">oRelatedTarget</span><span class="p">)))</span> <span class="p">{</span>
                <span class="nx">bMovingToSubmenu</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
            <span class="p">}</span>
    
            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">handledMouseOutEvent</span> <span class="o">&amp;&amp;</span> <span class="p">((</span><span class="nx">oRelatedTarget</span> <span class="o">!=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">element</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">oRelatedTarget</span><span class="p">))</span> <span class="o">||</span> <span class="nx">bMovingToSubmenu</span><span class="p">))</span> <span class="p">{</span>
                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">bMovingToSubmenu</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
                    <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
                        
                        <span class="nx">nSubmenuHideDelay</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU_HIDE_DELAY</span><span class="p">);</span>
                        <span class="nx">nShowDelay</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SHOW_DELAY</span><span class="p">);</span>
                        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="k">this</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">nSubmenuHideDelay</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="nx">nSubmenuHideDelay</span> <span class="o">&gt;=</span> <span class="nx">nShowDelay</span><span class="p">)</span> <span class="p">{</span>
                            <span class="k">this</span><span class="p">.</span><span class="nx">_execSubmenuHideDelay</span><span class="p">(</span><span class="nx">oSubmenu</span><span class="p">,</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getPageX</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">),</span> <span class="nx">nSubmenuHideDelay</span><span class="p">);</span>
                        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                            <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>
                        <span class="p">}</span>
                    <span class="p">}</span>
                <span class="p">}</span>
    
                <span class="nx">oItem</span><span class="p">.</span><span class="nx">handledMouseOutEvent</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
                <span class="nx">oItem</span><span class="p">.</span><span class="nx">handledMouseOverEvent</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>

        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;onMouseout: oRelatedTarget = &quot;</span> <span class="o">+</span> <span class="nx">oRelatedTarget</span><span class="p">.</span><span class="nx">className</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;onMouseout: this.element = &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">id</span><span class="p">);</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;onMouseout: Ancestorthis.element = &quot;</span> <span class="o">+</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">oRelatedTarget</span><span class="p">));</span>
        <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;onMouseout: canHide = &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">_didMouseLeave</span><span class="p">(</span><span class="nx">oRelatedTarget</span><span class="p">));</span>        

        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_bHandledMouseOutEvent</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_didMouseLeave</span><span class="p">(</span><span class="nx">oRelatedTarget</span><span class="p">)</span> <span class="o">||</span> <span class="nx">bMovingToSubmenu</span><span class="p">)</span> <span class="p">{</span>
                <span class="c1">// Menu mouseout logic</span>
                <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_useHideDelay</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_execHideDelay</span><span class="p">();</span>
                <span class="p">}</span>
    
                <span class="nx">Event</span><span class="p">.</span><span class="nx">removeListener</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_MOUSEMOVE</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_onMouseMove</span><span class="p">);</span>
        
                <span class="k">this</span><span class="p">.</span><span class="nx">_nCurrentMouseX</span> <span class="o">=</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getPageX</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">);</span>
        
                <span class="k">this</span><span class="p">.</span><span class="nx">_bHandledMouseOutEvent</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_bHandledMouseOverEvent</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">}</span>
    <span class="p">}</span>

<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * Utilility method to determine if we really moused out of the menu based on the related target</span>
<span class="cm"> * @method _didMouseLeave</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @param {HTMLElement} oRelatedTarget The related target based on which we&#39;re making the decision</span>
<span class="cm"> * @return {boolean} true if it&#39;s OK to hide based on the related target.</span>
<span class="cm"> */</span>
<span class="nx">_didMouseLeave</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">oRelatedTarget</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Hide if we&#39;re not moving back to the element from somewhere inside the element, or we&#39;re moving to an element inside the menu.</span>
    <span class="c1">// The shadow is treated as an edge case, inside inside the menu, but we get no further mouseouts, because it overflows the element,</span>
    <span class="c1">// so we need to close when moving to the menu. </span>
    <span class="k">return</span> <span class="p">(</span><span class="nx">oRelatedTarget</span> <span class="o">===</span> <span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span> <span class="o">||</span> <span class="p">(</span><span class="nx">oRelatedTarget</span> <span class="o">!=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">oRelatedTarget</span><span class="p">)));</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm">* @method _onMouseMove</span>
<span class="cm">* @description &quot;click&quot; event handler for the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {Event} p_oEvent Object representing the DOM event object passed </span>
<span class="cm">* back by the event utility (YAHOO.util.Event).</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that </span>
<span class="cm">* fired the event.</span>
<span class="cm">*/</span>
<span class="nx">_onMouseMove</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oEvent</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_bStopMouseEventHandlers</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="k">this</span><span class="p">.</span><span class="nx">_nCurrentMouseX</span> <span class="o">=</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getPageX</span><span class="p">(</span><span class="nx">p_oEvent</span><span class="p">);</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onClick</span>
<span class="cm">* @description &quot;click&quot; event handler for the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onClick</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oEvent</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
        <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span>
        <span class="nx">bInMenuAnchor</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">,</span>
        <span class="nx">oMenu</span><span class="p">,</span>
        <span class="nx">oRoot</span><span class="p">,</span>
        <span class="nx">sId</span><span class="p">,</span>
        <span class="nx">sURL</span><span class="p">,</span>
        <span class="nx">nHashPos</span><span class="p">,</span>
        <span class="nx">nLen</span><span class="p">;</span>


    <span class="kd">var</span> <span class="nx">hide</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
        
        <span class="nx">oRoot</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">();</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">oRoot</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span> <span class="o">||</span> 
            <span class="nx">oRoot</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_STATIC</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oRoot</span><span class="p">.</span><span class="nx">clearActiveItem</span><span class="p">();</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="nx">oRoot</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>
        
        <span class="p">}</span>
    
    <span class="p">};</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_DISABLED</span><span class="p">))</span> <span class="p">{</span>
        
            <span class="nx">Event</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">);</span>

            <span class="nx">hide</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
    
            
            <span class="cm">/*</span>
<span class="cm">                 Check if the URL of the anchor is pointing to an element that is </span>
<span class="cm">                 a child of the menu.</span>
<span class="cm">            */</span>
            
            <span class="nx">sURL</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_URL</span><span class="p">);</span>

        
            <span class="k">if</span> <span class="p">(</span><span class="nx">sURL</span><span class="p">)</span> <span class="p">{</span>
    
                <span class="nx">nHashPos</span> <span class="o">=</span> <span class="nx">sURL</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">_HASH</span><span class="p">);</span>
    
                <span class="nx">nLen</span> <span class="o">=</span> <span class="nx">sURL</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
    
    
                <span class="k">if</span> <span class="p">(</span><span class="nx">nHashPos</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
    
                    <span class="nx">sURL</span> <span class="o">=</span> <span class="nx">sURL</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="nx">nHashPos</span><span class="p">,</span> <span class="nx">nLen</span><span class="p">);</span>
        
                    <span class="nx">nLen</span> <span class="o">=</span> <span class="nx">sURL</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
    
    
                    <span class="k">if</span> <span class="p">(</span><span class="nx">nLen</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
    
                        <span class="nx">sId</span> <span class="o">=</span> <span class="nx">sURL</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nx">nLen</span><span class="p">);</span>
    
                        <span class="nx">oMenu</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuManager</span><span class="p">.</span><span class="nx">getMenu</span><span class="p">(</span><span class="nx">sId</span><span class="p">);</span>
                        
                        <span class="k">if</span> <span class="p">(</span><span class="nx">oMenu</span><span class="p">)</span> <span class="p">{</span>

                            <span class="nx">bInMenuAnchor</span> <span class="o">=</span> 
                                <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">()</span> <span class="o">===</span> <span class="nx">oMenu</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">());</span>

                        <span class="p">}</span>
                        
                    <span class="p">}</span>
                    <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">nLen</span> <span class="o">===</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
    
                        <span class="nx">bInMenuAnchor</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
                    
                    <span class="p">}</span>
    
                <span class="p">}</span>
            
            <span class="p">}</span>

    
            <span class="k">if</span> <span class="p">(</span><span class="nx">bInMenuAnchor</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_TARGET</span><span class="p">))</span> <span class="p">{</span>
    
                <span class="nx">Event</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">);</span>
                

                <span class="k">if</span> <span class="p">(</span><span class="nx">UA</span><span class="p">.</span><span class="nx">webkit</span><span class="p">)</span> <span class="p">{</span>
                
                    <span class="nx">oItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
                
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>

                    <span class="nx">oItem</span><span class="p">.</span><span class="nx">focusEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>
                
                <span class="p">}</span>
            
            <span class="p">}</span>
    
    
            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">oSubmenu</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_KEEP_OPEN</span><span class="p">))</span> <span class="p">{</span>
    
                <span class="nx">hide</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
    
            <span class="p">}</span>
            
        <span class="p">}</span>
    
    <span class="p">}</span>

<span class="p">},</span>

<span class="cm">/*</span>
<span class="cm">    This function is called to prevent a bug in Firefox.  In Firefox,</span>
<span class="cm">    moving a DOM element into a stationary mouse pointer will cause the </span>
<span class="cm">    browser to fire mouse events.  This can result in the menu mouse</span>
<span class="cm">    event handlers being called uncessarily, especially when menus are </span>
<span class="cm">    moved into a stationary mouse pointer as a result of a </span>
<span class="cm">    key event handler.</span>
<span class="cm">*/</span>
<span class="cm">/**</span>
<span class="cm"> * Utility method to stop mouseevents from being fired if the DOM</span>
<span class="cm"> * changes under a stationary mouse pointer (as opposed to the mouse moving</span>
<span class="cm"> * over a DOM element).</span>
<span class="cm"> * </span>
<span class="cm"> * @method _stopMouseEventHandlers</span>
<span class="cm"> * @private</span>
<span class="cm"> */</span>
<span class="nx">_stopMouseEventHandlers</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_bStopMouseEventHandlers</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

    <span class="nx">Lang</span><span class="p">.</span><span class="nx">later</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_bStopMouseEventHandlers</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
    <span class="p">});</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm">* @method _onKeyDown</span>
<span class="cm">* @description &quot;keydown&quot; event handler for the menu.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onKeyDown</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oEvent</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
        <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span>
        <span class="nx">oSubmenu</span><span class="p">,</span>
        <span class="nx">oItemCfg</span><span class="p">,</span>
        <span class="nx">oParentItem</span><span class="p">,</span>
        <span class="nx">oRoot</span><span class="p">,</span>
        <span class="nx">oNextItem</span><span class="p">,</span>
        <span class="nx">oBody</span><span class="p">,</span>
        <span class="nx">nBodyScrollTop</span><span class="p">,</span>
        <span class="nx">nBodyOffsetHeight</span><span class="p">,</span>
        <span class="nx">aItems</span><span class="p">,</span>
        <span class="nx">nItems</span><span class="p">,</span>
        <span class="nx">nNextItemOffsetTop</span><span class="p">,</span>
        <span class="nx">nScrollTarget</span><span class="p">,</span>
        <span class="nx">oParentMenu</span><span class="p">,</span>
        <span class="nx">oFocusedEl</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_useHideDelay</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_cancelHideDelay</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_DISABLED</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">oItemCfg</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">;</span>
        <span class="nx">oParentItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">;</span>

        <span class="k">switch</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">.</span><span class="nx">keyCode</span><span class="p">)</span> <span class="p">{</span>
    
            <span class="k">case</span> <span class="mi">38</span><span class="o">:</span>    <span class="c1">// Up arrow</span>
            <span class="k">case</span> <span class="mi">40</span><span class="o">:</span>    <span class="c1">// Down arrow</span>
    
                <span class="nx">oNextItem</span> <span class="o">=</span> <span class="p">(</span><span class="nx">oEvent</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">==</span> <span class="mi">38</span><span class="p">)</span> <span class="o">?</span> 
                    <span class="nx">oItem</span><span class="p">.</span><span class="nx">getPreviousEnabledSibling</span><span class="p">()</span> <span class="o">:</span> 
                    <span class="nx">oItem</span><span class="p">.</span><span class="nx">getNextEnabledSibling</span><span class="p">();</span>
        
                <span class="k">if</span> <span class="p">(</span><span class="nx">oNextItem</span><span class="p">)</span> <span class="p">{</span>

                    <span class="k">this</span><span class="p">.</span><span class="nx">clearActiveItem</span><span class="p">();</span>

                    <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
                    <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>

                    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MAX_HEIGHT</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">||</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">hasClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">body</span><span class="p">,</span> <span class="nx">_YUI_MENU_BODY_SCROLLED</span><span class="p">))</span> <span class="p">{</span>

                        <span class="nx">oBody</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">body</span><span class="p">;</span>
                        <span class="nx">nBodyScrollTop</span> <span class="o">=</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">;</span>
                        <span class="nx">nBodyOffsetHeight</span> <span class="o">=</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>
                        <span class="nx">aItems</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItems</span><span class="p">();</span>
                        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>
                        <span class="nx">nNextItemOffsetTop</span> <span class="o">=</span> <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">offsetTop</span><span class="p">;</span>


                        <span class="k">if</span> <span class="p">(</span><span class="nx">oEvent</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">==</span> <span class="mi">40</span> <span class="p">)</span> <span class="p">{</span>    <span class="c1">// Down</span>
                       
                            <span class="k">if</span> <span class="p">(</span><span class="nx">nNextItemOffsetTop</span> <span class="o">&gt;=</span> <span class="p">(</span><span class="nx">nBodyOffsetHeight</span> <span class="o">+</span> <span class="nx">nBodyScrollTop</span><span class="p">))</span> <span class="p">{</span>

                                <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">nNextItemOffsetTop</span> <span class="o">-</span> <span class="nx">nBodyOffsetHeight</span><span class="p">;</span>

                            <span class="p">}</span>
                            <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">nNextItemOffsetTop</span> <span class="o">&lt;=</span> <span class="nx">nBodyScrollTop</span><span class="p">)</span> <span class="p">{</span>
                            
                                <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
                            
                            <span class="p">}</span>


                            <span class="k">if</span> <span class="p">(</span><span class="nx">oNextItem</span> <span class="o">==</span> <span class="nx">aItems</span><span class="p">[</span><span class="nx">nItems</span><span class="p">])</span> <span class="p">{</span>

                                <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">offsetTop</span><span class="p">;</span>

                            <span class="p">}</span>

                        <span class="p">}</span>
                        <span class="k">else</span> <span class="p">{</span>  <span class="c1">// Up</span>

                            <span class="k">if</span> <span class="p">(</span><span class="nx">nNextItemOffsetTop</span> <span class="o">&lt;=</span> <span class="nx">nBodyScrollTop</span><span class="p">)</span> <span class="p">{</span>

                                <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">nNextItemOffsetTop</span> <span class="o">-</span> <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>
                            
                            <span class="p">}</span>
                            <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">nNextItemOffsetTop</span> <span class="o">&gt;=</span> <span class="p">(</span><span class="nx">nBodyScrollTop</span> <span class="o">+</span> <span class="nx">nBodyOffsetHeight</span><span class="p">))</span> <span class="p">{</span>
                            
                                <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">nNextItemOffsetTop</span><span class="p">;</span>
                            
                            <span class="p">}</span>


                            <span class="k">if</span> <span class="p">(</span><span class="nx">oNextItem</span> <span class="o">==</span> <span class="nx">aItems</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="p">{</span>
                            
                                <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
                            
                            <span class="p">}</span>

                        <span class="p">}</span>


                        <span class="nx">nBodyScrollTop</span> <span class="o">=</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">;</span>
                        <span class="nx">nScrollTarget</span> <span class="o">=</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollHeight</span> <span class="o">-</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>

                        <span class="k">if</span> <span class="p">(</span><span class="nx">nBodyScrollTop</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

                            <span class="k">this</span><span class="p">.</span><span class="nx">_disableScrollHeader</span><span class="p">();</span>
                            <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollFooter</span><span class="p">();</span>

                        <span class="p">}</span>
                        <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">nBodyScrollTop</span> <span class="o">==</span> <span class="nx">nScrollTarget</span><span class="p">)</span> <span class="p">{</span>

                             <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollHeader</span><span class="p">();</span>
                             <span class="k">this</span><span class="p">.</span><span class="nx">_disableScrollFooter</span><span class="p">();</span>

                        <span class="p">}</span>
                        <span class="k">else</span> <span class="p">{</span>

                            <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollHeader</span><span class="p">();</span>
                            <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollFooter</span><span class="p">();</span>

                        <span class="p">}</span>

                    <span class="p">}</span>

                <span class="p">}</span>

    
                <span class="nx">Event</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">);</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">_stopMouseEventHandlers</span><span class="p">();</span>
    
            <span class="k">break</span><span class="p">;</span>
            
    
            <span class="k">case</span> <span class="mi">39</span><span class="o">:</span>    <span class="c1">// Right arrow</span>
    
                <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItemCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
    
                <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
    
                    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">oItemCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">))</span> <span class="p">{</span>
        
                        <span class="nx">oItemCfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
        
                    <span class="p">}</span>
    
                    <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">show</span><span class="p">();</span>
                    <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">setInitialFocus</span><span class="p">();</span>
                    <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">setInitialSelection</span><span class="p">();</span>
    
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
    
                    <span class="nx">oRoot</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">();</span>
                    
                    <span class="k">if</span> <span class="p">(</span><span class="nx">oRoot</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span><span class="p">)</span> <span class="p">{</span>
    
                        <span class="nx">oNextItem</span> <span class="o">=</span> <span class="nx">oRoot</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">.</span><span class="nx">getNextEnabledSibling</span><span class="p">();</span>
    
                        <span class="k">if</span> <span class="p">(</span><span class="nx">oNextItem</span><span class="p">)</span> <span class="p">{</span>
                        
                            <span class="nx">oRoot</span><span class="p">.</span><span class="nx">clearActiveItem</span><span class="p">();</span>
    
                            <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    
                            <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
    
                            <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
    
                                <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">show</span><span class="p">();</span>
                                <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">setInitialFocus</span><span class="p">();</span>
                            
                            <span class="p">}</span>
                            <span class="k">else</span> <span class="p">{</span>
    
                                <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
                            
                            <span class="p">}</span>
                        
                        <span class="p">}</span>
                    
                    <span class="p">}</span>
                
                <span class="p">}</span>
    
    
                <span class="nx">Event</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">);</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">_stopMouseEventHandlers</span><span class="p">();</span>

            <span class="k">break</span><span class="p">;</span>
    
    
            <span class="k">case</span> <span class="mi">37</span><span class="o">:</span>    <span class="c1">// Left arrow</span>
    
                <span class="k">if</span> <span class="p">(</span><span class="nx">oParentItem</span><span class="p">)</span> <span class="p">{</span>
    
                    <span class="nx">oParentMenu</span> <span class="o">=</span> <span class="nx">oParentItem</span><span class="p">.</span><span class="nx">parent</span><span class="p">;</span>
    
                    <span class="k">if</span> <span class="p">(</span><span class="nx">oParentMenu</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span><span class="p">)</span> <span class="p">{</span>
    
                        <span class="nx">oNextItem</span> <span class="o">=</span> 
                            <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">.</span><span class="nx">getPreviousEnabledSibling</span><span class="p">();</span>
    
                        <span class="k">if</span> <span class="p">(</span><span class="nx">oNextItem</span><span class="p">)</span> <span class="p">{</span>
                        
                            <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">clearActiveItem</span><span class="p">();</span>
    
                            <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    
                            <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
    
                            <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
                            
                                <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">show</span><span class="p">();</span>
                                <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">setInitialFocus</span><span class="p">();</span>
                            
                            <span class="p">}</span>
                            <span class="k">else</span> <span class="p">{</span>
    
                                <span class="nx">oNextItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
                            
                            <span class="p">}</span>
                        
                        <span class="p">}</span> 
                    
                    <span class="p">}</span>
                    <span class="k">else</span> <span class="p">{</span>
    
                        <span class="k">this</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>
    
                        <span class="nx">oParentItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
                    
                    <span class="p">}</span>
    
                <span class="p">}</span>
    
                <span class="nx">Event</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">);</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">_stopMouseEventHandlers</span><span class="p">();</span>

            <span class="k">break</span><span class="p">;</span>        
    
        <span class="p">}</span>


    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oEvent</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">==</span> <span class="mi">27</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// Esc key</span>

        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span>
        
            <span class="k">this</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>

            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
            
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="c1">// Focus the element that previously had focus</span>

                <span class="nx">oFocusedEl</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_focusedElement</span><span class="p">;</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">oFocusedEl</span> <span class="o">&amp;&amp;</span> <span class="nx">oFocusedEl</span><span class="p">.</span><span class="nx">focus</span><span class="p">)</span> <span class="p">{</span>

                    <span class="k">try</span> <span class="p">{</span>
                        <span class="nx">oFocusedEl</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
                    <span class="p">}</span>
                    <span class="k">catch</span><span class="p">(</span><span class="nx">ex</span><span class="p">)</span> <span class="p">{</span>
                    <span class="p">}</span>

                <span class="p">}</span>
                
            <span class="p">}</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span> <span class="o">&amp;&amp;</span> <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_VISIBLE</span><span class="p">))</span> <span class="p">{</span>
            
                <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
            
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">.</span><span class="nx">blur</span><span class="p">();</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
        
            <span class="p">}</span>
        
        <span class="p">}</span>


        <span class="nx">Event</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">);</span>
    
    <span class="p">}</span>
    
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onKeyPress</span>
<span class="cm">* @description &quot;keypress&quot; event handler for a Menu instance.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event </span>
<span class="cm">* was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onKeyPress</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>
    
    <span class="kd">var</span> <span class="nx">oEvent</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oEvent</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">==</span> <span class="mi">40</span> <span class="o">||</span> <span class="nx">oEvent</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">==</span> <span class="mi">38</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Event</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">(</span><span class="nx">oEvent</span><span class="p">);</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onBlur</span>
<span class="cm">* @description &quot;blur&quot; event handler for a Menu instance.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event </span>
<span class="cm">* was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onBlur</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>
        
    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_hasFocus</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_hasFocus</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
    <span class="p">}</span>

<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm">* @method _onYChange</span>
<span class="cm">* @description &quot;y&quot; event handler for a Menu instance.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event </span>
<span class="cm">* was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onYChange</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oParent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">,</span>
        <span class="nx">nScrollTop</span><span class="p">,</span>
        <span class="nx">oIFrame</span><span class="p">,</span>
        <span class="nx">nY</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oParent</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">nScrollTop</span> <span class="o">=</span> <span class="nx">oParent</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">;</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">nScrollTop</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
    
            <span class="nx">nY</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">)</span> <span class="o">-</span> <span class="nx">nScrollTop</span><span class="p">);</span>
            
            <span class="nx">Dom</span><span class="p">.</span><span class="nx">setY</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">nY</span><span class="p">);</span>

            <span class="nx">oIFrame</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">iframe</span><span class="p">;</span>            
    

            <span class="k">if</span> <span class="p">(</span><span class="nx">oIFrame</span><span class="p">)</span> <span class="p">{</span>
    
                <span class="nx">Dom</span><span class="p">.</span><span class="nx">setY</span><span class="p">(</span><span class="nx">oIFrame</span><span class="p">,</span> <span class="nx">nY</span><span class="p">);</span>
    
            <span class="p">}</span>
            
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">,</span> <span class="nx">nY</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
        
        <span class="p">}</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onScrollTargetMouseOver</span>
<span class="cm">* @description &quot;mouseover&quot; event handler for the menu&#39;s &quot;header&quot; and &quot;footer&quot; </span>
<span class="cm">* elements.  Used to scroll the body of the menu up and down when the </span>
<span class="cm">* menu&#39;s &quot;maxheight&quot; configuration property is set to a value greater than 0.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {Event} p_oEvent Object representing the DOM event object passed </span>
<span class="cm">* back by the event utility (YAHOO.util.Event).</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that </span>
<span class="cm">* fired the event.</span>
<span class="cm">*/</span>
<span class="nx">_onScrollTargetMouseOver</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oEvent</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oBodyScrollTimer</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_bodyScrollTimer</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oBodyScrollTimer</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oBodyScrollTimer</span><span class="p">.</span><span class="nx">cancel</span><span class="p">();</span>

    <span class="p">}</span>


    <span class="k">this</span><span class="p">.</span><span class="nx">_cancelHideDelay</span><span class="p">();</span>


    <span class="kd">var</span> <span class="nx">oTarget</span> <span class="o">=</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getTarget</span><span class="p">(</span><span class="nx">p_oEvent</span><span class="p">),</span>
        <span class="nx">oBody</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">body</span><span class="p">,</span>
        <span class="nx">nScrollIncrement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SCROLL_INCREMENT</span><span class="p">),</span>
        <span class="nx">nScrollTarget</span><span class="p">,</span>
        <span class="nx">fnScrollFunction</span><span class="p">;</span>


    <span class="kd">function</span> <span class="nx">scrollBodyDown</span><span class="p">()</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">nScrollTop</span> <span class="o">=</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">;</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">nScrollTop</span> <span class="o">&lt;</span> <span class="nx">nScrollTarget</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nScrollTop</span> <span class="o">+</span> <span class="nx">nScrollIncrement</span><span class="p">);</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollHeader</span><span class="p">();</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">nScrollTarget</span><span class="p">;</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_bodyScrollTimer</span><span class="p">.</span><span class="nx">cancel</span><span class="p">();</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_disableScrollFooter</span><span class="p">();</span>

        <span class="p">}</span>

    <span class="p">}</span>


    <span class="kd">function</span> <span class="nx">scrollBodyUp</span><span class="p">()</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">nScrollTop</span> <span class="o">=</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">;</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">nScrollTop</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nScrollTop</span> <span class="o">-</span> <span class="nx">nScrollIncrement</span><span class="p">);</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollFooter</span><span class="p">();</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_bodyScrollTimer</span><span class="p">.</span><span class="nx">cancel</span><span class="p">();</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_disableScrollHeader</span><span class="p">();</span>

        <span class="p">}</span>

    <span class="p">}</span>

    
    <span class="k">if</span> <span class="p">(</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">hasClass</span><span class="p">(</span><span class="nx">oTarget</span><span class="p">,</span> <span class="nx">_HD</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">fnScrollFunction</span> <span class="o">=</span> <span class="nx">scrollBodyUp</span><span class="p">;</span>
    
    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>

        <span class="nx">nScrollTarget</span> <span class="o">=</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollHeight</span> <span class="o">-</span> <span class="nx">oBody</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>

        <span class="nx">fnScrollFunction</span> <span class="o">=</span> <span class="nx">scrollBodyDown</span><span class="p">;</span>
    
    <span class="p">}</span>
    

    <span class="k">this</span><span class="p">.</span><span class="nx">_bodyScrollTimer</span> <span class="o">=</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">later</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="nx">fnScrollFunction</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onScrollTargetMouseOut</span>
<span class="cm">* @description &quot;mouseout&quot; event handler for the menu&#39;s &quot;header&quot; and &quot;footer&quot; </span>
<span class="cm">* elements.  Used to stop scrolling the body of the menu up and down when the </span>
<span class="cm">* menu&#39;s &quot;maxheight&quot; configuration property is set to a value greater than 0.</span>
<span class="cm">* @protected</span>
<span class="cm">* @param {Event} p_oEvent Object representing the DOM event object passed </span>
<span class="cm">* back by the event utility (YAHOO.util.Event).</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that </span>
<span class="cm">* fired the event.</span>
<span class="cm">*/</span>
<span class="nx">_onScrollTargetMouseOut</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oEvent</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oBodyScrollTimer</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_bodyScrollTimer</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">oBodyScrollTimer</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oBodyScrollTimer</span><span class="p">.</span><span class="nx">cancel</span><span class="p">();</span>

    <span class="p">}</span>
    
    <span class="k">this</span><span class="p">.</span><span class="nx">_cancelHideDelay</span><span class="p">();</span>

<span class="p">},</span>



<span class="c1">// Private methods</span>


<span class="cm">/**</span>
<span class="cm">* @method _onInit</span>
<span class="cm">* @description &quot;init&quot; event handler for the menu.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onInit</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">subscribeToConfigEvent</span><span class="p">(</span><span class="nx">_VISIBLE</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_onVisibleChange</span><span class="p">);</span>

    <span class="kd">var</span> <span class="nx">bRootMenu</span> <span class="o">=</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">,</span>
        <span class="nx">bLazyLoad</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">lazyLoad</span><span class="p">;</span>


    <span class="cm">/*</span>
<span class="cm">        Automatically initialize a menu&#39;s subtree if:</span>

<span class="cm">        1) This is the root menu and lazyload is off</span>
<span class="cm">        </span>
<span class="cm">        2) This is the root menu, lazyload is on, but the menu is </span>
<span class="cm">           already visible</span>

<span class="cm">        3) This menu is a submenu and lazyload is off</span>
<span class="cm">    */</span>



    <span class="k">if</span> <span class="p">(((</span><span class="nx">bRootMenu</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">bLazyLoad</span><span class="p">)</span> <span class="o">||</span> 
        <span class="p">(</span><span class="nx">bRootMenu</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_VISIBLE</span><span class="p">)</span> <span class="o">||</span> 
        <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_STATIC</span><span class="p">))</span> <span class="o">||</span> 
        <span class="p">(</span><span class="o">!</span><span class="nx">bRootMenu</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">bLazyLoad</span><span class="p">))</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItemGroups</span><span class="p">().</span><span class="nx">length</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">srcElement</span><span class="p">)</span> <span class="p">{</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_initSubTree</span><span class="p">();</span>
        
        <span class="p">}</span>


        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">itemData</span><span class="p">)</span> <span class="p">{</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">addItems</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">itemData</span><span class="p">);</span>

        <span class="p">}</span>
    
    <span class="p">}</span>
    <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">bLazyLoad</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">fireQueue</span><span class="p">();</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onBeforeRender</span>
<span class="cm">* @description &quot;beforerender&quot; event handler for the menu.  Appends all of the </span>
<span class="cm">* &lt;code&gt;&amp;#60;ul&amp;#62;&lt;/code&gt;, &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; and their accompanying </span>
<span class="cm">* title elements to the body element of the menu.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onBeforeRender</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oEl</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span>
        <span class="nx">nListElements</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span>
        <span class="nx">bFirstList</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
        <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
        <span class="nx">oUL</span><span class="p">,</span>
        <span class="nx">oGroupTitle</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">nListElements</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">do</span> <span class="p">{</span>

            <span class="nx">oUL</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oUL</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">bFirstList</span><span class="p">)</span> <span class="p">{</span>
        
                    <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">oUL</span><span class="p">,</span> <span class="nx">_FIRST_OF_TYPE</span><span class="p">);</span>
                    <span class="nx">bFirstList</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
        
                <span class="p">}</span>


                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="nx">oEl</span><span class="p">,</span> <span class="nx">oUL</span><span class="p">))</span> <span class="p">{</span>

                    <span class="k">this</span><span class="p">.</span><span class="nx">appendToBody</span><span class="p">(</span><span class="nx">oUL</span><span class="p">);</span>

                <span class="p">}</span>


                <span class="nx">oGroupTitle</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">oGroupTitle</span><span class="p">)</span> <span class="p">{</span>

                    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="nx">oEl</span><span class="p">,</span> <span class="nx">oGroupTitle</span><span class="p">))</span> <span class="p">{</span>

                        <span class="nx">oUL</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">.</span><span class="nx">insertBefore</span><span class="p">(</span><span class="nx">oGroupTitle</span><span class="p">,</span> <span class="nx">oUL</span><span class="p">);</span>

                    <span class="p">}</span>


                    <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">oUL</span><span class="p">,</span> <span class="nx">_HAS_TITLE</span><span class="p">);</span>

                <span class="p">}</span>

            <span class="p">}</span>

            <span class="nx">i</span><span class="o">++</span><span class="p">;</span>

        <span class="p">}</span>
        <span class="k">while</span> <span class="p">(</span><span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">nListElements</span><span class="p">);</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onRender</span>
<span class="cm">* @description &quot;render&quot; event handler for the menu.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onRender</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span> 

        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_VISIBLE</span><span class="p">))</span> <span class="p">{</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">positionOffScreen</span><span class="p">();</span>

        <span class="p">}</span>
    
    <span class="p">}</span>

<span class="p">},</span>





<span class="cm">/**</span>
<span class="cm">* @method _onBeforeShow</span>
<span class="cm">* @description &quot;beforeshow&quot; event handler for the menu.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onBeforeShow</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">nOptions</span><span class="p">,</span>
        <span class="nx">n</span><span class="p">,</span>
        <span class="nx">oSrcElement</span><span class="p">,</span>
        <span class="nx">oContainer</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_CONTAINER</span><span class="p">);</span>


    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">lazyLoad</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItemGroups</span><span class="p">().</span><span class="nx">length</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">srcElement</span><span class="p">)</span> <span class="p">{</span>
        
            <span class="k">this</span><span class="p">.</span><span class="nx">_initSubTree</span><span class="p">();</span>

        <span class="p">}</span>


        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">itemData</span><span class="p">)</span> <span class="p">{</span>

            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">parent</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">parent</span> <span class="o">&amp;&amp;</span> 
                <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">srcElement</span> <span class="o">&amp;&amp;</span> 
                <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">srcElement</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">()</span> <span class="o">==</span> 
                <span class="nx">_SELECT</span><span class="p">)</span> <span class="p">{</span>

                <span class="nx">nOptions</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">itemData</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
    
                <span class="k">for</span><span class="p">(</span><span class="nx">n</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">n</span><span class="o">&lt;</span><span class="nx">nOptions</span><span class="p">;</span> <span class="nx">n</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>

                    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">itemData</span><span class="p">[</span><span class="nx">n</span><span class="p">].</span><span class="nx">tagName</span><span class="p">)</span> <span class="p">{</span>

                        <span class="k">this</span><span class="p">.</span><span class="nx">addItem</span><span class="p">((</span><span class="k">new</span> <span class="k">this</span><span class="p">.</span><span class="nx">ITEM_TYPE</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">itemData</span><span class="p">[</span><span class="nx">n</span><span class="p">])));</span>
    
                    <span class="p">}</span>
    
                <span class="p">}</span>
            
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">addItems</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">itemData</span><span class="p">);</span>
            
            <span class="p">}</span>
        
        <span class="p">}</span>


        <span class="nx">oSrcElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">srcElement</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">oSrcElement</span><span class="p">)</span> <span class="p">{</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oSrcElement</span><span class="p">.</span><span class="nx">tagName</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">()</span> <span class="o">==</span> <span class="nx">_SELECT</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">inDocument</span><span class="p">(</span><span class="nx">oSrcElement</span><span class="p">))</span> <span class="p">{</span>

                    <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="nx">oSrcElement</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">);</span>
                
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
                
                    <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="nx">oContainer</span><span class="p">);</span>
                
                <span class="p">}</span>

            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">();</span>

            <span class="p">}</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">element</span><span class="p">);</span>     

            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="nx">oContainer</span><span class="p">);</span>

            <span class="p">}</span>                

        <span class="p">}</span>

    <span class="p">}</span>



    <span class="kd">var</span> <span class="nx">oParent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">,</span>
        <span class="nx">aAlignment</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">oParent</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">refireEvent</span><span class="p">(</span><span class="nx">_XY</span><span class="p">);</span>
   
    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oParent</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">aAlignment</span> <span class="o">=</span> <span class="nx">oParent</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU_ALIGNMENT</span><span class="p">);</span>
        
        <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_CONTEXT</span><span class="p">,</span> <span class="p">[</span><span class="nx">oParent</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">aAlignment</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nx">aAlignment</span><span class="p">[</span><span class="mi">1</span><span class="p">]]);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">align</span><span class="p">();</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="nx">getConstrainedY</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">y</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oMenu</span> <span class="o">=</span> <span class="k">this</span><span class="p">,</span>
    
        <span class="nx">aContext</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_CONTEXT</span><span class="p">),</span>
        <span class="nx">nInitialMaxHeight</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MAX_HEIGHT</span><span class="p">),</span>

        <span class="nx">nMaxHeight</span><span class="p">,</span>

        <span class="nx">oOverlapPositions</span> <span class="o">=</span> <span class="p">{</span>

            <span class="s2">&quot;trbr&quot;</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
            <span class="s2">&quot;tlbl&quot;</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
            <span class="s2">&quot;bltl&quot;</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
            <span class="s2">&quot;brtr&quot;</span><span class="o">:</span> <span class="kc">true</span>

        <span class="p">},</span>

        <span class="nx">bPotentialContextOverlap</span> <span class="o">=</span> <span class="p">(</span><span class="nx">aContext</span> <span class="o">&amp;&amp;</span> <span class="nx">oOverlapPositions</span><span class="p">[</span><span class="nx">aContext</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="nx">aContext</span><span class="p">[</span><span class="mi">2</span><span class="p">]]),</span>
    
        <span class="nx">oMenuEl</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span>
        <span class="nx">nMenuOffsetHeight</span> <span class="o">=</span> <span class="nx">oMenuEl</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">,</span>
    
        <span class="nx">nViewportOffset</span> <span class="o">=</span> <span class="nx">Overlay</span><span class="p">.</span><span class="nx">VIEWPORT_OFFSET</span><span class="p">,</span>
        <span class="nx">viewPortHeight</span> <span class="o">=</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">getViewportHeight</span><span class="p">(),</span>
        <span class="nx">scrollY</span> <span class="o">=</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">getDocumentScrollTop</span><span class="p">(),</span>

        <span class="nx">bCanConstrain</span> <span class="o">=</span> 
            <span class="p">(</span><span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MIN_SCROLL_HEIGHT</span><span class="p">)</span> <span class="o">+</span> <span class="nx">nViewportOffset</span> <span class="o">&lt;</span> <span class="nx">viewPortHeight</span><span class="p">),</span>

        <span class="nx">nAvailableHeight</span><span class="p">,</span>

        <span class="nx">oContextEl</span><span class="p">,</span>
        <span class="nx">nContextElY</span><span class="p">,</span>
        <span class="nx">nContextElHeight</span><span class="p">,</span>

        <span class="nx">bFlipped</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>

        <span class="nx">nTopRegionHeight</span><span class="p">,</span>
        <span class="nx">nBottomRegionHeight</span><span class="p">,</span>

        <span class="nx">topConstraint</span> <span class="o">=</span> <span class="nx">scrollY</span> <span class="o">+</span> <span class="nx">nViewportOffset</span><span class="p">,</span>
        <span class="nx">bottomConstraint</span> <span class="o">=</span> <span class="nx">scrollY</span> <span class="o">+</span> <span class="nx">viewPortHeight</span> <span class="o">-</span> <span class="nx">nMenuOffsetHeight</span> <span class="o">-</span> <span class="nx">nViewportOffset</span><span class="p">,</span>

        <span class="nx">yNew</span> <span class="o">=</span> <span class="nx">y</span><span class="p">;</span>
        

    <span class="kd">var</span> <span class="nx">flipVertical</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">nNewY</span><span class="p">;</span>
    
        <span class="c1">// The Menu is below the context element, flip it above</span>
        <span class="k">if</span> <span class="p">((</span><span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">)</span> <span class="o">-</span> <span class="nx">scrollY</span><span class="p">)</span> <span class="o">&gt;</span> <span class="nx">nContextElY</span><span class="p">)</span> <span class="p">{</span> 
            <span class="nx">nNewY</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nContextElY</span> <span class="o">-</span> <span class="nx">nMenuOffsetHeight</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>	<span class="c1">// The Menu is above the context element, flip it below</span>
            <span class="nx">nNewY</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nContextElY</span> <span class="o">+</span> <span class="nx">nContextElHeight</span><span class="p">);</span>
        <span class="p">}</span>

        <span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">,</span> <span class="p">(</span><span class="nx">nNewY</span> <span class="o">+</span> <span class="nx">scrollY</span><span class="p">),</span> <span class="kc">true</span><span class="p">);</span>
        
        <span class="k">return</span> <span class="nx">nNewY</span><span class="p">;</span>
    
    <span class="p">};</span>


    <span class="cm">/*</span>
<span class="cm">         Uses the context element&#39;s position to calculate the availble height </span>
<span class="cm">         above and below it to display its corresponding Menu.</span>
<span class="cm">    */</span>

    <span class="kd">var</span> <span class="nx">getDisplayRegionHeight</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

        <span class="c1">// The Menu is below the context element</span>
        <span class="k">if</span> <span class="p">((</span><span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">)</span> <span class="o">-</span> <span class="nx">scrollY</span><span class="p">)</span> <span class="o">&gt;</span> <span class="nx">nContextElY</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span> <span class="p">(</span><span class="nx">nBottomRegionHeight</span> <span class="o">-</span> <span class="nx">nViewportOffset</span><span class="p">);</span>				
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>	<span class="c1">// The Menu is above the context element</span>
            <span class="k">return</span> <span class="p">(</span><span class="nx">nTopRegionHeight</span> <span class="o">-</span> <span class="nx">nViewportOffset</span><span class="p">);</span>				
        <span class="p">}</span>

    <span class="p">};</span>


    <span class="cm">/*</span>
<span class="cm">        Sets the Menu&#39;s &quot;y&quot; configuration property to the correct value based on its</span>
<span class="cm">        current orientation.</span>
<span class="cm">    */</span> 

    <span class="kd">var</span> <span class="nx">alignY</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">nNewY</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">((</span><span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">)</span> <span class="o">-</span> <span class="nx">scrollY</span><span class="p">)</span> <span class="o">&gt;</span> <span class="nx">nContextElY</span><span class="p">)</span> <span class="p">{</span> 
            <span class="nx">nNewY</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nContextElY</span> <span class="o">+</span> <span class="nx">nContextElHeight</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>	
            <span class="nx">nNewY</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nContextElY</span> <span class="o">-</span> <span class="nx">oMenuEl</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">);</span>
        <span class="p">}</span>

        <span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">,</span> <span class="p">(</span><span class="nx">nNewY</span> <span class="o">+</span> <span class="nx">scrollY</span><span class="p">),</span> <span class="kc">true</span><span class="p">);</span>
    
    <span class="p">};</span>


    <span class="c1">//	Resets the maxheight of the Menu to the value set by the user</span>

    <span class="kd">var</span> <span class="nx">resetMaxHeight</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

        <span class="nx">oMenu</span><span class="p">.</span><span class="nx">_setScrollHeight</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MAX_HEIGHT</span><span class="p">));</span>

        <span class="nx">oMenu</span><span class="p">.</span><span class="nx">hideEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="nx">resetMaxHeight</span><span class="p">);</span>
    
    <span class="p">};</span>


    <span class="cm">/*</span>
<span class="cm">        Trys to place the Menu in the best possible position (either above or </span>
<span class="cm">        below its corresponding context element).</span>
<span class="cm">    */</span>

    <span class="kd">var</span> <span class="nx">setVerticalPosition</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">nDisplayRegionHeight</span> <span class="o">=</span> <span class="nx">getDisplayRegionHeight</span><span class="p">(),</span>
            <span class="nx">bMenuHasItems</span> <span class="o">=</span> <span class="p">(</span><span class="nx">oMenu</span><span class="p">.</span><span class="nx">getItems</span><span class="p">().</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">),</span>
            <span class="nx">nMenuMinScrollHeight</span><span class="p">,</span>
            <span class="nx">fnReturnVal</span><span class="p">;</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">nMenuOffsetHeight</span> <span class="o">&gt;</span> <span class="nx">nDisplayRegionHeight</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">nMenuMinScrollHeight</span> <span class="o">=</span> 
                <span class="nx">bMenuHasItems</span> <span class="o">?</span> <span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MIN_SCROLL_HEIGHT</span><span class="p">)</span> <span class="o">:</span> <span class="nx">nMenuOffsetHeight</span><span class="p">;</span>


            <span class="k">if</span> <span class="p">((</span><span class="nx">nDisplayRegionHeight</span> <span class="o">&gt;</span> <span class="nx">nMenuMinScrollHeight</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">bMenuHasItems</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">nMaxHeight</span> <span class="o">=</span> <span class="nx">nDisplayRegionHeight</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="k">else</span> <span class="p">{</span>
                <span class="nx">nMaxHeight</span> <span class="o">=</span> <span class="nx">nInitialMaxHeight</span><span class="p">;</span>
            <span class="p">}</span>


            <span class="nx">oMenu</span><span class="p">.</span><span class="nx">_setScrollHeight</span><span class="p">(</span><span class="nx">nMaxHeight</span><span class="p">);</span>
            <span class="nx">oMenu</span><span class="p">.</span><span class="nx">hideEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="nx">resetMaxHeight</span><span class="p">);</span>
            

            <span class="c1">// Re-align the Menu since its height has just changed</span>
            <span class="c1">// as a result of the setting of the maxheight property.</span>

            <span class="nx">alignY</span><span class="p">();</span>
            

            <span class="k">if</span> <span class="p">(</span><span class="nx">nDisplayRegionHeight</span> <span class="o">&lt;</span> <span class="nx">nMenuMinScrollHeight</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">bFlipped</span><span class="p">)</span> <span class="p">{</span>
    
                    <span class="cm">/*</span>
<span class="cm">                         All possible positions and values for the &quot;maxheight&quot; </span>
<span class="cm">                         configuration property have been tried, but none were </span>
<span class="cm">                         successful, so fall back to the original size and position.</span>
<span class="cm">                    */</span>

                    <span class="nx">flipVertical</span><span class="p">();</span>
                    
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
    
                    <span class="nx">flipVertical</span><span class="p">();</span>

                    <span class="nx">bFlipped</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
    
                    <span class="nx">fnReturnVal</span> <span class="o">=</span> <span class="nx">setVerticalPosition</span><span class="p">();</span>
    
                <span class="p">}</span>
                
            <span class="p">}</span>
        
        <span class="p">}</span>
        <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">nMaxHeight</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">nMaxHeight</span> <span class="o">!==</span> <span class="nx">nInitialMaxHeight</span><span class="p">))</span> <span class="p">{</span>
        
            <span class="nx">oMenu</span><span class="p">.</span><span class="nx">_setScrollHeight</span><span class="p">(</span><span class="nx">nInitialMaxHeight</span><span class="p">);</span>
            <span class="nx">oMenu</span><span class="p">.</span><span class="nx">hideEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="nx">resetMaxHeight</span><span class="p">);</span>

            <span class="c1">// Re-align the Menu since its height has just changed</span>
            <span class="c1">// as a result of the setting of the maxheight property.</span>

            <span class="nx">alignY</span><span class="p">();</span>
        
        <span class="p">}</span>

        <span class="k">return</span> <span class="nx">fnReturnVal</span><span class="p">;</span>

    <span class="p">};</span>


    <span class="c1">// Determine if the current value for the Menu&#39;s &quot;y&quot; configuration property will</span>
    <span class="c1">// result in the Menu being positioned outside the boundaries of the viewport</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">y</span> <span class="o">&lt;</span> <span class="nx">topConstraint</span> <span class="o">||</span> <span class="nx">y</span>  <span class="o">&gt;</span> <span class="nx">bottomConstraint</span><span class="p">)</span> <span class="p">{</span>

        <span class="c1">// The current value for the Menu&#39;s &quot;y&quot; configuration property WILL</span>
        <span class="c1">// result in the Menu being positioned outside the boundaries of the viewport</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">bCanConstrain</span><span class="p">)</span> <span class="p">{</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_PREVENT_CONTEXT_OVERLAP</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">bPotentialContextOverlap</span><span class="p">)</span> <span class="p">{</span>
        
                <span class="c1">//	SOLUTION #1:</span>
                <span class="c1">//	If the &quot;preventcontextoverlap&quot; configuration property is set to &quot;true&quot;, </span>
                <span class="c1">//	try to flip and/or scroll the Menu to both keep it inside the boundaries of the </span>
                <span class="c1">//	viewport AND from overlaping its context element (MenuItem or MenuBarItem).</span>

                <span class="nx">oContextEl</span> <span class="o">=</span> <span class="nx">aContext</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
                <span class="nx">nContextElHeight</span> <span class="o">=</span> <span class="nx">oContextEl</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>
                <span class="nx">nContextElY</span> <span class="o">=</span> <span class="p">(</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">getY</span><span class="p">(</span><span class="nx">oContextEl</span><span class="p">)</span> <span class="o">-</span> <span class="nx">scrollY</span><span class="p">);</span>
    
                <span class="nx">nTopRegionHeight</span> <span class="o">=</span> <span class="nx">nContextElY</span><span class="p">;</span>
                <span class="nx">nBottomRegionHeight</span> <span class="o">=</span> <span class="p">(</span><span class="nx">viewPortHeight</span> <span class="o">-</span> <span class="p">(</span><span class="nx">nContextElY</span> <span class="o">+</span> <span class="nx">nContextElHeight</span><span class="p">));</span>
    
                <span class="nx">setVerticalPosition</span><span class="p">();</span>
                
                <span class="nx">yNew</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">);</span>
        
            <span class="p">}</span>
            <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="nx">oMenu</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span><span class="p">)</span> <span class="o">&amp;&amp;</span> 
                <span class="nx">nMenuOffsetHeight</span> <span class="o">&gt;=</span> <span class="nx">viewPortHeight</span><span class="p">)</span> <span class="p">{</span>

                <span class="c1">//	SOLUTION #2:</span>
                <span class="c1">//	If the Menu exceeds the height of the viewport, introduce scroll bars</span>
                <span class="c1">//	to keep the Menu inside the boundaries of the viewport</span>

                <span class="nx">nAvailableHeight</span> <span class="o">=</span> <span class="p">(</span><span class="nx">viewPortHeight</span> <span class="o">-</span> <span class="p">(</span><span class="nx">nViewportOffset</span> <span class="o">*</span> <span class="mi">2</span><span class="p">));</span>
        
                <span class="k">if</span> <span class="p">(</span><span class="nx">nAvailableHeight</span> <span class="o">&gt;</span> <span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MIN_SCROLL_HEIGHT</span><span class="p">))</span> <span class="p">{</span>
        
                    <span class="nx">oMenu</span><span class="p">.</span><span class="nx">_setScrollHeight</span><span class="p">(</span><span class="nx">nAvailableHeight</span><span class="p">);</span>
                    <span class="nx">oMenu</span><span class="p">.</span><span class="nx">hideEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="nx">resetMaxHeight</span><span class="p">);</span>
        
                    <span class="nx">alignY</span><span class="p">();</span>
                    
                    <span class="nx">yNew</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_Y</span><span class="p">);</span>
                
                <span class="p">}</span>
        
            <span class="p">}</span>	
            <span class="k">else</span> <span class="p">{</span>

                <span class="c1">//	SOLUTION #3:</span>
            
                <span class="k">if</span> <span class="p">(</span><span class="nx">y</span> <span class="o">&lt;</span> <span class="nx">topConstraint</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">yNew</span>  <span class="o">=</span> <span class="nx">topConstraint</span><span class="p">;</span>
                <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">y</span>  <span class="o">&gt;</span> <span class="nx">bottomConstraint</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">yNew</span>  <span class="o">=</span> <span class="nx">bottomConstraint</span><span class="p">;</span>
                <span class="p">}</span>				
            
            <span class="p">}</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="c1">//	The &quot;y&quot; configuration property cannot be set to a value that will keep</span>
            <span class="c1">//	entire Menu inside the boundary of the viewport.  Therefore, set  </span>
            <span class="c1">//	the &quot;y&quot; configuration property to scrollY to keep as much of the </span>
            <span class="c1">//	Menu inside the viewport as possible.</span>
            <span class="nx">yNew</span> <span class="o">=</span> <span class="nx">nViewportOffset</span> <span class="o">+</span> <span class="nx">scrollY</span><span class="p">;</span>
        <span class="p">}</span>	

    <span class="p">}</span>

    <span class="k">return</span> <span class="nx">yNew</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onHide</span>
<span class="cm">* @description &quot;hide&quot; event handler for the menu.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onHide</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">===</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="k">this</span><span class="p">.</span><span class="nx">positionOffScreen</span><span class="p">();</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onShow</span>
<span class="cm">* @description &quot;show&quot; event handler for the menu.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onShow</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oParent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">,</span>
        <span class="nx">oParentMenu</span><span class="p">,</span>
        <span class="nx">oElement</span><span class="p">,</span>
        <span class="nx">nOffsetWidth</span><span class="p">,</span>
        <span class="nx">sWidth</span><span class="p">;</span>        


    <span class="kd">function</span> <span class="nx">disableAutoSubmenuDisplay</span><span class="p">(</span><span class="nx">p_oEvent</span><span class="p">)</span> <span class="p">{</span>

        <span class="kd">var</span> <span class="nx">oTarget</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">p_oEvent</span><span class="p">.</span><span class="nx">type</span> <span class="o">==</span> <span class="nx">_MOUSEDOWN</span> <span class="o">||</span> <span class="p">(</span><span class="nx">p_oEvent</span><span class="p">.</span><span class="nx">type</span> <span class="o">==</span> <span class="nx">_KEYDOWN</span> <span class="o">&amp;&amp;</span> <span class="nx">p_oEvent</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">==</span> <span class="mi">27</span><span class="p">))</span> <span class="p">{</span>

            <span class="cm">/*  </span>
<span class="cm">                Set the &quot;autosubmenudisplay&quot; to &quot;false&quot; if the user</span>
<span class="cm">                clicks outside the menu bar.</span>
<span class="cm">            */</span>

            <span class="nx">oTarget</span> <span class="o">=</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">getTarget</span><span class="p">(</span><span class="nx">p_oEvent</span><span class="p">);</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oTarget</span> <span class="o">!=</span> <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">element</span> <span class="o">||</span> <span class="o">!</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">isAncestor</span><span class="p">(</span><span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">oTarget</span><span class="p">))</span> <span class="p">{</span>

                <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_AUTO_SUBMENU_DISPLAY</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>

                <span class="nx">Event</span><span class="p">.</span><span class="nx">removeListener</span><span class="p">(</span><span class="nb">document</span><span class="p">,</span> <span class="nx">_MOUSEDOWN</span><span class="p">,</span> <span class="nx">disableAutoSubmenuDisplay</span><span class="p">);</span>
                <span class="nx">Event</span><span class="p">.</span><span class="nx">removeListener</span><span class="p">(</span><span class="nb">document</span><span class="p">,</span> <span class="nx">_KEYDOWN</span><span class="p">,</span> <span class="nx">disableAutoSubmenuDisplay</span><span class="p">);</span>

            <span class="p">}</span>
        
        <span class="p">}</span>

    <span class="p">}</span>


    <span class="kd">function</span> <span class="nx">onSubmenuHide</span><span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_sWidth</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="nx">_EMPTY_STRING</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">hideEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="nx">onSubmenuHide</span><span class="p">,</span> <span class="nx">p_sWidth</span><span class="p">);</span>
    
    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oParent</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oParentMenu</span> <span class="o">=</span> <span class="nx">oParent</span><span class="p">.</span><span class="nx">parent</span><span class="p">;</span>


        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_AUTO_SUBMENU_DISPLAY</span><span class="p">)</span> <span class="o">&amp;&amp;</span> 
            <span class="p">(</span><span class="nx">oParentMenu</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span> <span class="o">||</span> 
            <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_STATIC</span><span class="p">))</span> <span class="p">{</span>

            <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_AUTO_SUBMENU_DISPLAY</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>

            <span class="nx">Event</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="nb">document</span><span class="p">,</span> <span class="nx">_MOUSEDOWN</span><span class="p">,</span> <span class="nx">disableAutoSubmenuDisplay</span><span class="p">);</span>                             
            <span class="nx">Event</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="nb">document</span><span class="p">,</span> <span class="nx">_KEYDOWN</span><span class="p">,</span> <span class="nx">disableAutoSubmenuDisplay</span><span class="p">);</span>

        <span class="p">}</span>


        <span class="c1">//	The following fixes an issue with the selected state of a MenuItem </span>
        <span class="c1">//	not rendering correctly when a submenu is aligned to the left of</span>
        <span class="c1">//	its parent Menu instance.</span>

        <span class="k">if</span> <span class="p">((</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="s2">&quot;x&quot;</span><span class="p">)</span> <span class="o">&lt;</span> <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="s2">&quot;x&quot;</span><span class="p">))</span> <span class="o">&amp;&amp;</span> 
            <span class="p">(</span><span class="nx">UA</span><span class="p">.</span><span class="nx">gecko</span> <span class="o">&amp;&amp;</span> <span class="nx">UA</span><span class="p">.</span><span class="nx">gecko</span> <span class="o">&lt;</span> <span class="mf">1.9</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">))</span> <span class="p">{</span>

            <span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">;</span>
            <span class="nx">nOffsetWidth</span> <span class="o">=</span> <span class="nx">oElement</span><span class="p">.</span><span class="nx">offsetWidth</span><span class="p">;</span>
            
            <span class="cm">/*</span>
<span class="cm">                Measuring the difference of the offsetWidth before and after</span>
<span class="cm">                setting the &quot;width&quot; style attribute allows us to compute the </span>
<span class="cm">                about of padding and borders applied to the element, which in </span>
<span class="cm">                turn allows us to set the &quot;width&quot; property correctly.</span>
<span class="cm">            */</span>
            
            <span class="nx">oElement</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">nOffsetWidth</span> <span class="o">+</span> <span class="nx">_PX</span><span class="p">;</span>
            
            <span class="nx">sWidth</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nOffsetWidth</span> <span class="o">-</span> <span class="p">(</span><span class="nx">oElement</span><span class="p">.</span><span class="nx">offsetWidth</span> <span class="o">-</span> <span class="nx">nOffsetWidth</span><span class="p">))</span> <span class="o">+</span> <span class="nx">_PX</span><span class="p">;</span>
            
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="nx">sWidth</span><span class="p">);</span>
        
            <span class="k">this</span><span class="p">.</span><span class="nx">hideEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="nx">onSubmenuHide</span><span class="p">,</span> <span class="nx">sWidth</span><span class="p">);</span>
        
        <span class="p">}</span>

    <span class="p">}</span>


    <span class="cm">/*</span>
<span class="cm">        Dynamically positioned, root Menus focus themselves when visible, and </span>
<span class="cm">        will then, when hidden, restore focus to the UI control that had focus </span>
<span class="cm">        before the Menu was made visible.</span>
<span class="cm">    */</span> 

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span> <span class="o">===</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">()</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">===</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">_focusedElement</span> <span class="o">=</span> <span class="nx">oFocusedElement</span><span class="p">;</span>
        
        <span class="k">this</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>
    
    <span class="p">}</span>


<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onBeforeHide</span>
<span class="cm">* @description &quot;beforehide&quot; event handler for the menu.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onBeforeHide</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oActiveItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">,</span>
        <span class="nx">oRoot</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">(),</span>
        <span class="nx">oConfig</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oActiveItem</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oConfig</span> <span class="o">=</span> <span class="nx">oActiveItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">;</span>

        <span class="nx">oConfig</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>

        <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oConfig</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>

        <span class="p">}</span>

    <span class="p">}</span>


    <span class="cm">/*</span>
<span class="cm">        Focus can get lost in IE when the mouse is moving from a submenu back to its parent Menu.  </span>
<span class="cm">        For this reason, it is necessary to maintain the focused state in a private property </span>
<span class="cm">        so that the _onMouseOver event handler is able to determined whether or not to set focus</span>
<span class="cm">        to MenuItems as the user is moving the mouse.</span>
<span class="cm">    */</span> 

    <span class="k">if</span> <span class="p">(</span><span class="nx">UA</span><span class="p">.</span><span class="nx">ie</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">===</span> <span class="nx">_DYNAMIC</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oRoot</span><span class="p">.</span><span class="nx">_hasFocus</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">hasFocus</span><span class="p">();</span>
    
    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oRoot</span> <span class="o">==</span> <span class="k">this</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oRoot</span><span class="p">.</span><span class="nx">blur</span><span class="p">();</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onParentMenuConfigChange</span>
<span class="cm">* @description &quot;configchange&quot; event handler for a submenu.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that </span>
<span class="cm">* subscribed to the event.</span>
<span class="cm">*/</span>
<span class="nx">_onParentMenuConfigChange</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oSubmenu</span><span class="p">)</span> <span class="p">{</span>
    
    <span class="kd">var</span> <span class="nx">sPropertyName</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span>
        <span class="nx">oPropertyValue</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">];</span>

    <span class="k">switch</span><span class="p">(</span><span class="nx">sPropertyName</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">case</span> <span class="nx">_IFRAME</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_CONSTRAIN_TO_VIEWPORT</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_HIDE_DELAY</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_SHOW_DELAY</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_SUBMENU_HIDE_DELAY</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_CLICK_TO_HIDE</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_EFFECT</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_CLASSNAME</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_SCROLL_INCREMENT</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_MAX_HEIGHT</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_MIN_SCROLL_HEIGHT</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_MONITOR_RESIZE</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_SHADOW</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_PREVENT_CONTEXT_OVERLAP</span><span class="o">:</span>
        <span class="k">case</span> <span class="nx">_KEEP_OPEN</span><span class="o">:</span>

            <span class="nx">p_oSubmenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">sPropertyName</span><span class="p">,</span> <span class="nx">oPropertyValue</span><span class="p">);</span>
                
        <span class="k">break</span><span class="p">;</span>
        
        <span class="k">case</span> <span class="nx">_SUBMENU_ALIGNMENT</span><span class="o">:</span>

            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">parent</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span><span class="p">))</span> <span class="p">{</span>
        
                <span class="nx">p_oSubmenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">sPropertyName</span><span class="p">,</span> <span class="nx">oPropertyValue</span><span class="p">);</span>
        
            <span class="p">}</span>
        
        <span class="k">break</span><span class="p">;</span>
        
    <span class="p">}</span>
    
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onParentMenuRender</span>
<span class="cm">* @description &quot;render&quot; event handler for a submenu.  Renders a  </span>
<span class="cm">* submenu in response to the firing of its parent&#39;s &quot;render&quot; event.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oSubmenu Object representing the submenu that </span>
<span class="cm">* subscribed to the event.</span>
<span class="cm">*/</span>
<span class="nx">_onParentMenuRender</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oSubmenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oParentMenu</span> <span class="o">=</span> <span class="nx">p_oSubmenu</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">parent</span><span class="p">,</span>
        <span class="nx">oParentCfg</span> <span class="o">=</span> <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">,</span>

        <span class="nx">oConfig</span> <span class="o">=</span> <span class="p">{</span>

            <span class="nx">constraintoviewport</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_CONSTRAIN_TO_VIEWPORT</span><span class="p">),</span>

            <span class="nx">xy</span><span class="o">:</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span>

            <span class="nx">clicktohide</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_CLICK_TO_HIDE</span><span class="p">),</span>
                
            <span class="nx">effect</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_EFFECT</span><span class="p">),</span>

            <span class="nx">showdelay</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SHOW_DELAY</span><span class="p">),</span>
            
            <span class="nx">hidedelay</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_HIDE_DELAY</span><span class="p">),</span>

            <span class="nx">submenuhidedelay</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU_HIDE_DELAY</span><span class="p">),</span>

            <span class="nx">classname</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_CLASSNAME</span><span class="p">),</span>
            
            <span class="nx">scrollincrement</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SCROLL_INCREMENT</span><span class="p">),</span>
            
            <span class="nx">maxheight</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MAX_HEIGHT</span><span class="p">),</span>

            <span class="nx">minscrollheight</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MIN_SCROLL_HEIGHT</span><span class="p">),</span>
            
            <span class="nx">iframe</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_IFRAME</span><span class="p">),</span>
            
            <span class="nx">shadow</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SHADOW</span><span class="p">),</span>

            <span class="nx">preventcontextoverlap</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_PREVENT_CONTEXT_OVERLAP</span><span class="p">),</span>
            
            <span class="nx">monitorresize</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MONITOR_RESIZE</span><span class="p">),</span>

            <span class="nx">keepopen</span><span class="o">:</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_KEEP_OPEN</span><span class="p">)</span>

        <span class="p">},</span>
        
        <span class="nx">oLI</span><span class="p">;</span>


    
    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="nx">oParentMenu</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuBar</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">oConfig</span><span class="p">[</span><span class="nx">_SUBMENU_ALIGNMENT</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oParentCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU_ALIGNMENT</span><span class="p">);</span>

    <span class="p">}</span>


    <span class="nx">p_oSubmenu</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">applyConfig</span><span class="p">(</span><span class="nx">oConfig</span><span class="p">);</span>


    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">lazyLoad</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oLI</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">.</span><span class="nx">element</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">parentNode</span> <span class="o">==</span> <span class="nx">oLI</span><span class="p">)</span> <span class="p">{</span>
    
            <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">();</span>
    
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="nx">oLI</span><span class="p">);</span>
    
        <span class="p">}</span>

    <span class="p">}</span>
    
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onMenuItemDestroy</span>
<span class="cm">* @description &quot;destroy&quot; event handler for the menu&#39;s items.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event </span>
<span class="cm">* that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item </span>
<span class="cm">* that fired the event.</span>
<span class="cm">*/</span>
<span class="nx">_onMenuItemDestroy</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">_removeItemFromGroupByValue</span><span class="p">(</span><span class="nx">p_oItem</span><span class="p">.</span><span class="nx">groupIndex</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onMenuItemConfigChange</span>
<span class="cm">* @description &quot;configchange&quot; event handler for the menu&#39;s items.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item </span>
<span class="cm">* that fired the event.</span>
<span class="cm">*/</span>
<span class="nx">_onMenuItemConfigChange</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">sPropertyName</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span>
        <span class="nx">oPropertyValue</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span>
        <span class="nx">oSubmenu</span><span class="p">;</span>


    <span class="k">switch</span><span class="p">(</span><span class="nx">sPropertyName</span><span class="p">)</span> <span class="p">{</span>

        <span class="k">case</span> <span class="nx">_SELECTED</span><span class="o">:</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oPropertyValue</span> <span class="o">===</span> <span class="kc">true</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span> <span class="o">=</span> <span class="nx">p_oItem</span><span class="p">;</span>
            
            <span class="p">}</span>

        <span class="k">break</span><span class="p">;</span>

        <span class="k">case</span> <span class="nx">_SUBMENU</span><span class="o">:</span>

            <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">];</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">_configureSubmenu</span><span class="p">(</span><span class="nx">p_oItem</span><span class="p">);</span>

            <span class="p">}</span>

        <span class="k">break</span><span class="p">;</span>

    <span class="p">}</span>

<span class="p">},</span>



<span class="c1">// Public event handlers for configuration properties</span>


<span class="cm">/**</span>
<span class="cm">* @method configVisible</span>
<span class="cm">* @description Event handler for when the &quot;visible&quot; configuration property </span>
<span class="cm">* the menu changes.</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that </span>
<span class="cm">* fired the event.</span>
<span class="cm">*/</span>
<span class="nx">configVisible</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">bVisible</span><span class="p">,</span>
        <span class="nx">sDisplay</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">configVisible</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">);</span>

    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>

        <span class="nx">bVisible</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
        <span class="nx">sDisplay</span> <span class="o">=</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">getStyle</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_DISPLAY</span><span class="p">);</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_VISIBILITY</span><span class="p">,</span> <span class="nx">_VISIBLE</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">bVisible</span><span class="p">)</span> <span class="p">{</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">sDisplay</span> <span class="o">!=</span> <span class="nx">_BLOCK</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">beforeShowEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>
                <span class="nx">Dom</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_DISPLAY</span><span class="p">,</span> <span class="nx">_BLOCK</span><span class="p">);</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">showEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>
            <span class="p">}</span>
        
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">sDisplay</span> <span class="o">==</span> <span class="nx">_BLOCK</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">beforeHideEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>
                <span class="nx">Dom</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_DISPLAY</span><span class="p">,</span> <span class="nx">_NONE</span><span class="p">);</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">hideEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>
            <span class="p">}</span>
        
        <span class="p">}</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method configPosition</span>
<span class="cm">* @description Event handler for when the &quot;position&quot; configuration property </span>
<span class="cm">* of the menu changes.</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that </span>
<span class="cm">* fired the event.</span>
<span class="cm">*/</span>
<span class="nx">configPosition</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span>
        <span class="nx">sCSSPosition</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="nx">_STATIC</span> <span class="o">?</span> <span class="nx">_STATIC</span> <span class="o">:</span> <span class="nx">_ABSOLUTE</span><span class="p">,</span>
        <span class="nx">oCfg</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">,</span>
        <span class="nx">nZIndex</span><span class="p">;</span>


    <span class="nx">Dom</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="nx">oElement</span><span class="p">,</span> <span class="nx">_POSITION</span><span class="p">,</span> <span class="nx">sCSSPosition</span><span class="p">);</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">sCSSPosition</span> <span class="o">==</span> <span class="nx">_STATIC</span><span class="p">)</span> <span class="p">{</span>

        <span class="c1">// Statically positioned menus are visible by default</span>
        
        <span class="nx">Dom</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="nx">oElement</span><span class="p">,</span> <span class="nx">_DISPLAY</span><span class="p">,</span> <span class="nx">_BLOCK</span><span class="p">);</span>

        <span class="nx">oCfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_VISIBLE</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>

    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>

        <span class="cm">/*</span>
<span class="cm">            Even though the &quot;visible&quot; property is queued to </span>
<span class="cm">            &quot;false&quot; by default, we need to set the &quot;visibility&quot; property to </span>
<span class="cm">            &quot;hidden&quot; since Overlay&#39;s &quot;configVisible&quot; implementation checks the </span>
<span class="cm">            element&#39;s &quot;visibility&quot; style property before deciding whether </span>
<span class="cm">            or not to show an Overlay instance.</span>
<span class="cm">        */</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="nx">oElement</span><span class="p">,</span> <span class="nx">_VISIBILITY</span><span class="p">,</span> <span class="nx">_HIDDEN</span><span class="p">);</span>
    
    <span class="p">}</span>


     <span class="k">if</span> <span class="p">(</span><span class="nx">sCSSPosition</span> <span class="o">==</span> <span class="nx">_ABSOLUTE</span><span class="p">)</span> <span class="p">{</span>
         <span class="nx">nZIndex</span> <span class="o">=</span> <span class="nx">oCfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_ZINDEX</span><span class="p">);</span>

         <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">nZIndex</span> <span class="o">||</span> <span class="nx">nZIndex</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
             <span class="nx">oCfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_ZINDEX</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
         <span class="p">}</span>

     <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method configIframe</span>
<span class="cm">* @description Event handler for when the &quot;iframe&quot; configuration property of </span>
<span class="cm">* the menu changes.</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that </span>
<span class="cm">* fired the event.</span>
<span class="cm">*/</span>
<span class="nx">configIframe</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>    

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">configIframe</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">);</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method configHideDelay</span>
<span class="cm">* @description Event handler for when the &quot;hidedelay&quot; configuration property </span>
<span class="cm">* of the menu changes.</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that </span>
<span class="cm">* fired the event.</span>
<span class="cm">*/</span>
<span class="nx">configHideDelay</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">nHideDelay</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">_useHideDelay</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nHideDelay</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method configContainer</span>
<span class="cm">* @description Event handler for when the &quot;container&quot; configuration property </span>
<span class="cm">* of the menu changes.</span>
<span class="cm">* @param {String} p_sType String representing the name of the event that </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu Object representing the menu that </span>
<span class="cm">* fired the event.</span>
<span class="cm">*/</span>
<span class="nx">configContainer</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oElement</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">oElement</span><span class="p">))</span> <span class="p">{</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_CONTAINER</span><span class="p">,</span> <span class="nx">Dom</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">oElement</span><span class="p">),</span> <span class="kc">true</span><span class="p">);</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _clearSetWidthFlag</span>
<span class="cm">* @description Change event listener for the &quot;width&quot; configuration property.  This listener is </span>
<span class="cm">* added when a Menu&#39;s &quot;width&quot; configuration property is set by the &quot;_setScrollHeight&quot; method, and </span>
<span class="cm">* is used to set the &quot;_widthSetForScroll&quot; property to &quot;false&quot; if the &quot;width&quot; configuration property </span>
<span class="cm">* is changed after it was set by the &quot;_setScrollHeight&quot; method.  If the &quot;_widthSetForScroll&quot; </span>
<span class="cm">* property is set to &quot;false&quot;, and the &quot;_setScrollHeight&quot; method is in the process of tearing down </span>
<span class="cm">* scrolling functionality, it will maintain the Menu&#39;s new width rather than reseting it.</span>
<span class="cm">* @private</span>
<span class="cm">*/</span>
<span class="nx">_clearSetWidthFlag</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">_widthSetForScroll</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
    
    <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">unsubscribeFromConfigEvent</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_clearSetWidthFlag</span><span class="p">);</span>

<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * @method _subscribeScrollHandlers</span>
<span class="cm"> * @param {HTMLElement} oHeader The scroll header element</span>
<span class="cm"> * @param {HTMLElement} oFooter The scroll footer element</span>
<span class="cm"> */</span>
<span class="nx">_subscribeScrollHandlers</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">oFooter</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">fnMouseOver</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_onScrollTargetMouseOver</span><span class="p">;</span>
    <span class="kd">var</span> <span class="nx">fnMouseOut</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_onScrollTargetMouseOut</span><span class="p">;</span>

    <span class="nx">Event</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">_MOUSEOVER</span><span class="p">,</span> <span class="nx">fnMouseOver</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    <span class="nx">Event</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">_MOUSEOUT</span><span class="p">,</span> <span class="nx">fnMouseOut</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    <span class="nx">Event</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">,</span> <span class="nx">_MOUSEOVER</span><span class="p">,</span> <span class="nx">fnMouseOver</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    <span class="nx">Event</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">,</span> <span class="nx">_MOUSEOUT</span><span class="p">,</span> <span class="nx">fnMouseOut</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * @method _unsubscribeScrollHandlers </span>
<span class="cm"> * @param {HTMLElement} oHeader The scroll header element</span>
<span class="cm"> * @param {HTMLElement} oFooter The scroll footer element</span>
<span class="cm"> */</span>
<span class="nx">_unsubscribeScrollHandlers</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">oFooter</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">fnMouseOver</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_onScrollTargetMouseOver</span><span class="p">;</span>
    <span class="kd">var</span> <span class="nx">fnMouseOut</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_onScrollTargetMouseOut</span><span class="p">;</span>
    
    <span class="nx">Event</span><span class="p">.</span><span class="nx">removeListener</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">_MOUSEOVER</span><span class="p">,</span> <span class="nx">fnMouseOver</span><span class="p">);</span>
    <span class="nx">Event</span><span class="p">.</span><span class="nx">removeListener</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">_MOUSEOUT</span><span class="p">,</span> <span class="nx">fnMouseOut</span><span class="p">);</span>
    <span class="nx">Event</span><span class="p">.</span><span class="nx">removeListener</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">,</span> <span class="nx">_MOUSEOVER</span><span class="p">,</span> <span class="nx">fnMouseOver</span><span class="p">);</span>
    <span class="nx">Event</span><span class="p">.</span><span class="nx">removeListener</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">,</span> <span class="nx">_MOUSEOUT</span><span class="p">,</span> <span class="nx">fnMouseOut</span><span class="p">);</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm">* @method _setScrollHeight</span>
<span class="cm">* @description </span>
<span class="cm">* @param {String} p_nScrollHeight Number representing the scrolling height of the Menu.</span>
<span class="cm">* @private</span>
<span class="cm">*/</span>
<span class="nx">_setScrollHeight</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_nScrollHeight</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">nScrollHeight</span> <span class="o">=</span> <span class="nx">p_nScrollHeight</span><span class="p">,</span>
        <span class="nx">bRefireIFrameAndShadow</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
        <span class="nx">bSetWidth</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
        <span class="nx">oElement</span><span class="p">,</span>
        <span class="nx">oBody</span><span class="p">,</span>
        <span class="nx">oHeader</span><span class="p">,</span>
        <span class="nx">oFooter</span><span class="p">,</span>
        <span class="nx">nMinScrollHeight</span><span class="p">,</span>
        <span class="nx">nHeight</span><span class="p">,</span>
        <span class="nx">nOffsetWidth</span><span class="p">,</span>
        <span class="nx">sWidth</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getItems</span><span class="p">().</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">;</span>
        <span class="nx">oBody</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">body</span><span class="p">;</span>
        <span class="nx">oHeader</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">header</span><span class="p">;</span>
        <span class="nx">oFooter</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">footer</span><span class="p">;</span>
        <span class="nx">nMinScrollHeight</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_MIN_SCROLL_HEIGHT</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">nScrollHeight</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="nx">nScrollHeight</span> <span class="o">&lt;</span> <span class="nx">nMinScrollHeight</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">nScrollHeight</span> <span class="o">=</span> <span class="nx">nMinScrollHeight</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="nx">oBody</span><span class="p">,</span> <span class="nx">_HEIGHT</span><span class="p">,</span> <span class="nx">_EMPTY_STRING</span><span class="p">);</span>
        <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="nx">oBody</span><span class="p">,</span> <span class="nx">_YUI_MENU_BODY_SCROLLED</span><span class="p">);</span>
        <span class="nx">oBody</span><span class="p">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>

        <span class="c1">//	Need to set a width for the Menu to fix the following problems in </span>
        <span class="c1">//	Firefox 2 and IE:</span>

        <span class="c1">//	#1) Scrolled Menus will render at 1px wide in Firefox 2</span>

        <span class="c1">//	#2) There is a bug in gecko-based browsers where an element whose </span>
        <span class="c1">//	&quot;position&quot; property is set to &quot;absolute&quot; and &quot;overflow&quot; property is </span>
        <span class="c1">//	set to &quot;hidden&quot; will not render at the correct width when its </span>
        <span class="c1">//	offsetParent&#39;s &quot;position&quot; property is also set to &quot;absolute.&quot;  It is </span>
        <span class="c1">//	possible to work around this bug by specifying a value for the width </span>
        <span class="c1">//	property in addition to overflow.</span>

        <span class="c1">//	#3) In IE it is necessary to give the Menu a width before the </span>
        <span class="c1">//	scrollbars are rendered to prevent the Menu from rendering with a </span>
        <span class="c1">//	width that is 100% of the browser viewport.</span>

        <span class="nx">bSetWidth</span> <span class="o">=</span> <span class="p">((</span><span class="nx">UA</span><span class="p">.</span><span class="nx">gecko</span> <span class="o">&amp;&amp;</span> <span class="nx">UA</span><span class="p">.</span><span class="nx">gecko</span> <span class="o">&lt;</span> <span class="mf">1.9</span><span class="p">)</span> <span class="o">||</span> <span class="nx">UA</span><span class="p">.</span><span class="nx">ie</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">nScrollHeight</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="nx">bSetWidth</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">))</span> <span class="p">{</span>

            <span class="nx">nOffsetWidth</span> <span class="o">=</span> <span class="nx">oElement</span><span class="p">.</span><span class="nx">offsetWidth</span><span class="p">;</span>
    
            <span class="cm">/*</span>
<span class="cm">                Measuring the difference of the offsetWidth before and after</span>
<span class="cm">                setting the &quot;width&quot; style attribute allows us to compute the </span>
<span class="cm">                about of padding and borders applied to the element, which in </span>
<span class="cm">                turn allows us to set the &quot;width&quot; property correctly.</span>
<span class="cm">            */</span>
            
            <span class="nx">oElement</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">nOffsetWidth</span> <span class="o">+</span> <span class="nx">_PX</span><span class="p">;</span>
    
            <span class="nx">sWidth</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nOffsetWidth</span> <span class="o">-</span> <span class="p">(</span><span class="nx">oElement</span><span class="p">.</span><span class="nx">offsetWidth</span> <span class="o">-</span> <span class="nx">nOffsetWidth</span><span class="p">))</span> <span class="o">+</span> <span class="nx">_PX</span><span class="p">;</span>


            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">unsubscribeFromConfigEvent</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_clearSetWidthFlag</span><span class="p">);</span>

            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Setting the \&quot;width\&quot; configuration property to &quot;</span> <span class="o">+</span> <span class="nx">sWidth</span> <span class="o">+</span> <span class="s2">&quot; for srolling.&quot;</span><span class="p">,</span> 
                <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="nx">sWidth</span><span class="p">);</span>


            <span class="cm">/*</span>
<span class="cm">                Set a flag (_widthSetForScroll) to maintain some history regarding how the </span>
<span class="cm">                &quot;width&quot; configuration property was set.  If the &quot;width&quot; configuration property </span>
<span class="cm">                is set by something other than the &quot;_setScrollHeight&quot; method, it will be </span>
<span class="cm">                necessary to maintain that new value and not clear the width if scrolling </span>
<span class="cm">                is turned off.</span>
<span class="cm">            */</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_widthSetForScroll</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">subscribeToConfigEvent</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_clearSetWidthFlag</span><span class="p">);</span>
    
        <span class="p">}</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">nScrollHeight</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="o">!</span><span class="nx">oHeader</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">oFooter</span><span class="p">))</span> <span class="p">{</span>

            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Creating header and footer for scrolling.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">setHeader</span><span class="p">(</span><span class="nx">_NON_BREAKING_SPACE</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">setFooter</span><span class="p">(</span><span class="nx">_NON_BREAKING_SPACE</span><span class="p">);</span>

            <span class="nx">oHeader</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">header</span><span class="p">;</span>
            <span class="nx">oFooter</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">footer</span><span class="p">;</span>

            <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">_TOP_SCROLLBAR</span><span class="p">);</span>
            <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">,</span> <span class="nx">_BOTTOM_SCROLLBAR</span><span class="p">);</span>

            <span class="nx">oElement</span><span class="p">.</span><span class="nx">insertBefore</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">oBody</span><span class="p">);</span>
            <span class="nx">oElement</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">);</span>
        
        <span class="p">}</span>

        <span class="nx">nHeight</span> <span class="o">=</span> <span class="nx">nScrollHeight</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">oHeader</span> <span class="o">&amp;&amp;</span> <span class="nx">oFooter</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">nHeight</span> <span class="o">=</span> <span class="p">(</span><span class="nx">nHeight</span> <span class="o">-</span> <span class="p">(</span><span class="nx">oHeader</span><span class="p">.</span><span class="nx">offsetHeight</span> <span class="o">+</span> <span class="nx">oFooter</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">));</span>
        <span class="p">}</span>
    
    
        <span class="k">if</span> <span class="p">((</span><span class="nx">nHeight</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">oBody</span><span class="p">.</span><span class="nx">offsetHeight</span> <span class="o">&gt;</span> <span class="nx">nScrollHeight</span><span class="p">))</span> <span class="p">{</span>

            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Setting up styles and event handlers for scrolling.&quot;</span><span class="p">,</span> 
                <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    
            <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="nx">oBody</span><span class="p">,</span> <span class="nx">_YUI_MENU_BODY_SCROLLED</span><span class="p">);</span>
            <span class="nx">Dom</span><span class="p">.</span><span class="nx">setStyle</span><span class="p">(</span><span class="nx">oBody</span><span class="p">,</span> <span class="nx">_HEIGHT</span><span class="p">,</span> <span class="p">(</span><span class="nx">nHeight</span> <span class="o">+</span> <span class="nx">_PX</span><span class="p">));</span>

            <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_hasScrollEventHandlers</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_subscribeScrollHandlers</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">oFooter</span><span class="p">);</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_hasScrollEventHandlers</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
            <span class="p">}</span>
    
            <span class="k">this</span><span class="p">.</span><span class="nx">_disableScrollHeader</span><span class="p">();</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollFooter</span><span class="p">();</span>
            
            <span class="nx">bRefireIFrameAndShadow</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>			
    
        <span class="p">}</span>
        <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">oHeader</span> <span class="o">&amp;&amp;</span> <span class="nx">oFooter</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Removing styles and event handlers for scrolling.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>
    

            <span class="cm">/*</span>
<span class="cm">                Only clear the the &quot;width&quot; configuration property if it was set the </span>
<span class="cm">                &quot;_setScrollHeight&quot; method and wasn&#39;t changed by some other means after it was set.</span>
<span class="cm">            */</span>	
    
            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_widthSetForScroll</span><span class="p">)</span> <span class="p">{</span>
    
                <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Clearing width used for scrolling.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">_widthSetForScroll</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>

                <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">unsubscribeFromConfigEvent</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_clearSetWidthFlag</span><span class="p">);</span>
    
                <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="nx">_EMPTY_STRING</span><span class="p">);</span>
            
            <span class="p">}</span>
    
    
            <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollHeader</span><span class="p">();</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_enableScrollFooter</span><span class="p">();</span>
    
            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_hasScrollEventHandlers</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_unsubscribeScrollHandlers</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">,</span> <span class="nx">oFooter</span><span class="p">);</span>    
                <span class="k">this</span><span class="p">.</span><span class="nx">_hasScrollEventHandlers</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
            <span class="p">}</span>

            <span class="nx">oElement</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">);</span>
            <span class="nx">oElement</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">);</span>
    
            <span class="k">this</span><span class="p">.</span><span class="nx">header</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">footer</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
            
            <span class="nx">bRefireIFrameAndShadow</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
        
        <span class="p">}</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">bRefireIFrameAndShadow</span><span class="p">)</span> <span class="p">{</span>
    
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">refireEvent</span><span class="p">(</span><span class="nx">_IFRAME</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">refireEvent</span><span class="p">(</span><span class="nx">_SHADOW</span><span class="p">);</span>
        
        <span class="p">}</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _setMaxHeight</span>
<span class="cm">* @description &quot;renderEvent&quot; handler used to defer the setting of the </span>
<span class="cm">* &quot;maxheight&quot; configuration property until the menu is rendered in lazy </span>
<span class="cm">* load scenarios.</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {Number} p_nMaxHeight Number representing the value to set for the </span>
<span class="cm">* &quot;maxheight&quot; configuration property.</span>
<span class="cm">* @private</span>
<span class="cm">*/</span>
<span class="nx">_setMaxHeight</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_nMaxHeight</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">_setScrollHeight</span><span class="p">(</span><span class="nx">p_nMaxHeight</span><span class="p">);</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">renderEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_setMaxHeight</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method configMaxHeight</span>
<span class="cm">* @description Event handler for when the &quot;maxheight&quot; configuration property of </span>
<span class="cm">* a Menu changes.</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event </span>
<span class="cm">* was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu The Menu instance fired</span>
<span class="cm">* the event.</span>
<span class="cm">*/</span>
<span class="nx">configMaxHeight</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">nMaxHeight</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">lazyLoad</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">body</span> <span class="o">&amp;&amp;</span> <span class="nx">nMaxHeight</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="k">this</span><span class="p">.</span><span class="nx">renderEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_setMaxHeight</span><span class="p">,</span> <span class="nx">nMaxHeight</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>

    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">_setScrollHeight</span><span class="p">(</span><span class="nx">nMaxHeight</span><span class="p">);</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method configClassName</span>
<span class="cm">* @description Event handler for when the &quot;classname&quot; configuration property of </span>
<span class="cm">* a menu changes.</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu The Menu instance fired the event.</span>
<span class="cm">*/</span>
<span class="nx">configClassName</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">sClassName</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_sClassName</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sClassName</span><span class="p">);</span>

    <span class="p">}</span>

    <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">sClassName</span><span class="p">);</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_sClassName</span> <span class="o">=</span> <span class="nx">sClassName</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method _onItemAdded</span>
<span class="cm">* @description &quot;itemadded&quot; event handler for a Menu instance.</span>
<span class="cm">* @private</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event </span>
<span class="cm">* was fired.</span>
<span class="cm">*/</span>
<span class="nx">_onItemAdded</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
    
    <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_DISABLED</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method configDisabled</span>
<span class="cm">* @description Event handler for when the &quot;disabled&quot; configuration property of </span>
<span class="cm">* a menu changes.</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu The Menu instance fired the event.</span>
<span class="cm">*/</span>
<span class="nx">configDisabled</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">bDisabled</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
        <span class="nx">aItems</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItems</span><span class="p">(),</span>
        <span class="nx">nItems</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">aItems</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
    
        <span class="k">if</span> <span class="p">(</span><span class="nx">nItems</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
        
            <span class="nx">i</span> <span class="o">=</span> <span class="nx">nItems</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>
    
            <span class="k">do</span> <span class="p">{</span>
    
                <span class="nx">aItems</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_DISABLED</span><span class="p">,</span> <span class="nx">bDisabled</span><span class="p">);</span>
            
            <span class="p">}</span>
            <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>
        
        <span class="p">}</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">bDisabled</span><span class="p">)</span> <span class="p">{</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">clearActiveItem</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>

            <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_DISABLED</span><span class="p">);</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">itemAddedEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onItemAdded</span><span class="p">);</span>

        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span> <span class="nx">_DISABLED</span><span class="p">);</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">itemAddedEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onItemAdded</span><span class="p">);</span>

        <span class="p">}</span>
        
    <span class="p">}</span>

<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * Resizes the shadow to match the container bounding element</span>
<span class="cm"> * </span>
<span class="cm"> * @method _sizeShadow</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
<span class="nx">_sizeShadow</span> <span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span>
        <span class="nx">oShadow</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">oShadow</span> <span class="o">&amp;&amp;</span> <span class="nx">oElement</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// Clear the previous width</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">oShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">&amp;&amp;</span> <span class="nx">oShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">oShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">_EMPTY_STRING</span><span class="p">;</span>
            <span class="nx">oShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">_EMPTY_STRING</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="nx">oShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="p">(</span><span class="nx">oElement</span><span class="p">.</span><span class="nx">offsetWidth</span> <span class="o">+</span> <span class="mi">6</span><span class="p">)</span> <span class="o">+</span> <span class="nx">_PX</span><span class="p">;</span>
        <span class="nx">oShadow</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="p">(</span><span class="nx">oElement</span><span class="p">.</span><span class="nx">offsetHeight</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="nx">_PX</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * Replaces the shadow element in the DOM with the current shadow element (this._shadow)</span>
<span class="cm"> * </span>
<span class="cm"> * @method _replaceShadow</span>
<span class="cm"> * @protected </span>
<span class="cm"> */</span>
<span class="nx">_replaceShadow</span> <span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">);</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * Adds the classname marker for a visible shadow, to the shadow element</span>
<span class="cm"> * </span>
<span class="cm"> * @method _addShadowVisibleClass</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
<span class="nx">_addShadowVisibleClass</span> <span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
    <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">,</span> <span class="nx">_YUI_MENU_SHADOW_VISIBLE</span><span class="p">);</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * Removes the classname marker for a visible shadow, from the shadow element</span>
<span class="cm"> * </span>
<span class="cm"> * @method _removeShadowVisibleClass</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
<span class="nx">_removeShadowVisibleClass</span> <span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
    <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">,</span> <span class="nx">_YUI_MENU_SHADOW_VISIBLE</span><span class="p">);</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * Removes the shadow element from the DOM, and unsubscribes all the listeners used to keep it in sync. Used</span>
<span class="cm"> * to handle setting the shadow to false.</span>
<span class="cm"> * </span>
<span class="cm"> * @method _removeShadow</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
<span class="nx">_removeShadow</span> <span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">p</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">);</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">p</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">p</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">beforeShowEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_addShadowVisibleClass</span><span class="p">);</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">beforeHideEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_removeShadowVisibleClass</span><span class="p">);</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">unsubscribeFromConfigEvent</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">unsubscribeFromConfigEvent</span><span class="p">(</span><span class="nx">_HEIGHT</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">unsubscribeFromConfigEvent</span><span class="p">(</span><span class="nx">_MAX_HEIGHT</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">unsubscribeFromConfigEvent</span><span class="p">(</span><span class="nx">_MAX_HEIGHT</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_replaceShadow</span><span class="p">);</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">changeContentEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>

    <span class="nx">Module</span><span class="p">.</span><span class="nx">textResizeEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * Used to create the shadow element, add it to the DOM, and subscribe listeners to keep it in sync.</span>
<span class="cm"> *</span>
<span class="cm"> * @method _createShadow</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
<span class="nx">_createShadow</span> <span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oShadow</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">,</span>
        <span class="nx">oElement</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">oShadow</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">m_oShadowTemplate</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">m_oShadowTemplate</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="nx">_DIV_LOWERCASE</span><span class="p">);</span>
            <span class="nx">m_oShadowTemplate</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="nx">_YUI_MENU_SHADOW_YUI_MENU_SHADOW_VISIBLE</span><span class="p">;</span>
        <span class="p">}</span>

        <span class="nx">oShadow</span> <span class="o">=</span> <span class="nx">m_oShadowTemplate</span><span class="p">.</span><span class="nx">cloneNode</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>

        <span class="nx">oElement</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">oShadow</span><span class="p">);</span>
        
        <span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span> <span class="o">=</span> <span class="nx">oShadow</span><span class="p">;</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">beforeShowEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_addShadowVisibleClass</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">beforeHideEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_removeShadowVisibleClass</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">UA</span><span class="p">.</span><span class="nx">ie</span><span class="p">)</span> <span class="p">{</span>
            <span class="cm">/*</span>
<span class="cm">                 Need to call sizeShadow &amp; syncIframe via setTimeout for </span>
<span class="cm">                 IE 7 Quirks Mode and IE 6 Standards Mode and Quirks Mode </span>
<span class="cm">                 or the shadow and iframe shim will not be sized and </span>
<span class="cm">                 positioned properly.</span>
<span class="cm">            */</span>
            <span class="nx">Lang</span><span class="p">.</span><span class="nx">later</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">();</span> 
                <span class="k">this</span><span class="p">.</span><span class="nx">syncIframe</span><span class="p">();</span>
            <span class="p">});</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">subscribeToConfigEvent</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">subscribeToConfigEvent</span><span class="p">(</span><span class="nx">_HEIGHT</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">subscribeToConfigEvent</span><span class="p">(</span><span class="nx">_MAX_HEIGHT</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">changeContentEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">);</span>

            <span class="nx">Module</span><span class="p">.</span><span class="nx">textResizeEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">destroyEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
                <span class="nx">Module</span><span class="p">.</span><span class="nx">textResizeEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
            <span class="p">});</span>
        <span class="p">}</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">subscribeToConfigEvent</span><span class="p">(</span><span class="nx">_MAX_HEIGHT</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_replaceShadow</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm"> * The beforeShow event handler used to set up the shadow lazily when the menu is made visible.</span>
<span class="cm"> * @method _shadowBeforeShow</span>
<span class="cm"> * @protected </span>
<span class="cm"> */</span>
<span class="nx">_shadowBeforeShow</span> <span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">)</span> <span class="p">{</span>

        <span class="c1">// If called because the &quot;shadow&quot; event was refired - just append again and resize</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_replaceShadow</span><span class="p">();</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">UA</span><span class="p">.</span><span class="nx">ie</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">();</span>
        <span class="p">}</span>
    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_createShadow</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">beforeShowEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadowBeforeShow</span><span class="p">);</span>
<span class="p">},</span>

<span class="cm">/**</span>
<span class="cm">* @method configShadow</span>
<span class="cm">* @description Event handler for when the &quot;shadow&quot; configuration property of </span>
<span class="cm">* a menu changes.</span>
<span class="cm">* @param {String} p_sType The name of the event that was fired.</span>
<span class="cm">* @param {Array} p_aArgs Collection of arguments sent when the event was fired.</span>
<span class="cm">* @param {YAHOO.widget.Menu} p_oMenu The Menu instance fired the event.</span>
<span class="cm">*/</span>
<span class="nx">configShadow</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oMenu</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">bShadow</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">bShadow</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_POSITION</span><span class="p">)</span> <span class="o">==</span> <span class="nx">_DYNAMIC</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_VISIBLE</span><span class="p">))</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadow</span><span class="p">)</span> <span class="p">{</span>
                <span class="c1">// If the &quot;shadow&quot; event was refired - just append again and resize</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_replaceShadow</span><span class="p">();</span>
                
                <span class="k">if</span> <span class="p">(</span><span class="nx">UA</span><span class="p">.</span><span class="nx">ie</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">this</span><span class="p">.</span><span class="nx">_sizeShadow</span><span class="p">();</span>
                <span class="p">}</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="k">this</span><span class="p">.</span><span class="nx">_createShadow</span><span class="p">();</span>
            <span class="p">}</span>
        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
            <span class="k">this</span><span class="p">.</span><span class="nx">beforeShowEvent</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadowBeforeShow</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">bShadow</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">beforeShowEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_shadowBeforeShow</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">_removeShadow</span><span class="p">();</span>
    <span class="p">}</span>
<span class="p">},</span>

<span class="c1">// Public methods</span>

<span class="cm">/**</span>
<span class="cm">* @method initEvents</span>
<span class="cm">* @description Initializes the custom events for the menu.</span>
<span class="cm">*/</span>
<span class="nx">initEvents</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">initEvents</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>

    <span class="c1">// Create custom events</span>

    <span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="nx">EVENT_TYPES</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span>
        <span class="nx">aEventData</span><span class="p">,</span>
        <span class="nx">oCustomEvent</span><span class="p">;</span>


    <span class="k">do</span> <span class="p">{</span>

        <span class="nx">aEventData</span> <span class="o">=</span> <span class="nx">EVENT_TYPES</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>

        <span class="nx">oCustomEvent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">createEvent</span><span class="p">(</span><span class="nx">aEventData</span><span class="p">[</span><span class="mi">1</span><span class="p">]);</span>
        <span class="nx">oCustomEvent</span><span class="p">.</span><span class="nx">signature</span> <span class="o">=</span> <span class="nx">CustomEvent</span><span class="p">.</span><span class="nx">LIST</span><span class="p">;</span>
        
        <span class="k">this</span><span class="p">[</span><span class="nx">aEventData</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="nx">oCustomEvent</span><span class="p">;</span>

    <span class="p">}</span>
    <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method positionOffScreen</span>
<span class="cm">* @description Positions the menu outside of the boundaries of the browser&#39;s </span>
<span class="cm">* viewport.  Called automatically when a menu is hidden to ensure that </span>
<span class="cm">* it doesn&#39;t force the browser to render uncessary scrollbars.</span>
<span class="cm">*/</span>
<span class="nx">positionOffScreen</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oIFrame</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">iframe</span><span class="p">,</span>
        <span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span>
        <span class="nx">sPos</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">OFF_SCREEN_POSITION</span><span class="p">;</span>
    
    <span class="nx">oElement</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">top</span> <span class="o">=</span> <span class="nx">_EMPTY_STRING</span><span class="p">;</span>
    <span class="nx">oElement</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">left</span> <span class="o">=</span> <span class="nx">_EMPTY_STRING</span><span class="p">;</span>
    
    <span class="k">if</span> <span class="p">(</span><span class="nx">oIFrame</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">top</span> <span class="o">=</span> <span class="nx">sPos</span><span class="p">;</span>
        <span class="nx">oIFrame</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">left</span> <span class="o">=</span> <span class="nx">sPos</span><span class="p">;</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method getRoot</span>
<span class="cm">* @description Finds the menu&#39;s root menu.</span>
<span class="cm">*/</span>
<span class="nx">getRoot</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">,</span>
        <span class="nx">oParentMenu</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oParentMenu</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">parent</span><span class="p">;</span>

        <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">oParentMenu</span> <span class="o">?</span> <span class="nx">oParentMenu</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">()</span> <span class="o">:</span> <span class="k">this</span><span class="p">;</span>

    <span class="p">}</span>
    <span class="k">else</span> <span class="p">{</span>
    
        <span class="nx">returnVal</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
    
    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method toString</span>
<span class="cm">* @description Returns a string representing the menu.</span>
<span class="cm">* @return {String}</span>
<span class="cm">*/</span>
<span class="nx">toString</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">sReturnVal</span> <span class="o">=</span> <span class="nx">_MENU</span><span class="p">,</span>
        <span class="nx">sId</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">id</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">sId</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">sReturnVal</span> <span class="o">+=</span> <span class="p">(</span><span class="nx">_SPACE</span> <span class="o">+</span> <span class="nx">sId</span><span class="p">);</span>
    
    <span class="p">}</span>

    <span class="k">return</span> <span class="nx">sReturnVal</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method setItemGroupTitle</span>
<span class="cm">* @description Sets the title of a group of menu items.</span>
<span class="cm">* @param {HTML} p_sGroupTitle String or markup specifying the title of the group. The title is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.</span>
<span class="cm">* @param {Number} p_nGroupIndex Optional. Number specifying the group to which</span>
<span class="cm">* the title belongs.</span>
<span class="cm">*/</span>
<span class="nx">setItemGroupTitle</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sGroupTitle</span><span class="p">,</span> <span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">nGroupIndex</span><span class="p">,</span>
        <span class="nx">oTitle</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">,</span>
        <span class="nx">nFirstIndex</span><span class="p">;</span>
        
    <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">p_sGroupTitle</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nx">p_sGroupTitle</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">nGroupIndex</span> <span class="o">=</span> <span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="o">?</span> <span class="nx">p_nGroupIndex</span> <span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
        <span class="nx">oTitle</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span><span class="p">[</span><span class="nx">nGroupIndex</span><span class="p">];</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">oTitle</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oTitle</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">p_sGroupTitle</span><span class="p">;</span>
            
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>

            <span class="nx">oTitle</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">GROUP_TITLE_TAG_NAME</span><span class="p">);</span>
                    
            <span class="nx">oTitle</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">p_sGroupTitle</span><span class="p">;</span>

            <span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span><span class="p">[</span><span class="nx">nGroupIndex</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oTitle</span><span class="p">;</span>

        <span class="p">}</span>


        <span class="nx">i</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>

        <span class="k">do</span> <span class="p">{</span>

            <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span><span class="p">[</span><span class="nx">i</span><span class="p">])</span> <span class="p">{</span>

                <span class="nx">Dom</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span><span class="p">[</span><span class="nx">i</span><span class="p">],</span> <span class="nx">_FIRST_OF_TYPE</span><span class="p">);</span>

                <span class="nx">nFirstIndex</span> <span class="o">=</span> <span class="nx">i</span><span class="p">;</span>

            <span class="p">}</span>

        <span class="p">}</span>
        <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">nFirstIndex</span> <span class="o">!==</span> <span class="kc">null</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">Dom</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span><span class="p">[</span><span class="nx">nFirstIndex</span><span class="p">],</span> 
                <span class="nx">_FIRST_OF_TYPE</span><span class="p">);</span>

        <span class="p">}</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">changeContentEvent</span><span class="p">.</span><span class="nx">fire</span><span class="p">();</span>

    <span class="p">}</span>

<span class="p">},</span>



<span class="cm">/**</span>
<span class="cm">* @method addItem</span>
<span class="cm">* @description Appends an item to the menu.</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem </span>
<span class="cm">* instance to be added to the menu.</span>
<span class="cm">* @param {HTML} p_oItem String or markup specifying content of the item to be added </span>
<span class="cm">* to the menu. The item text is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.</span>
<span class="cm">* @param {Object} p_oItem Object literal containing a set of menu item </span>
<span class="cm">* configuration properties.</span>
<span class="cm">* @param {Number} p_nGroupIndex Optional. Number indicating the group to</span>
<span class="cm">* which the item belongs.</span>
<span class="cm">* @return {YAHOO.widget.MenuItem}</span>
<span class="cm">*/</span>
<span class="nx">addItem</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oItem</span><span class="p">,</span> <span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_addItemToGroup</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method addItems</span>
<span class="cm">* @description Adds an array of items to the menu.</span>
<span class="cm">* @param {Array} p_aItems Array of items to be added to the menu.  The array </span>
<span class="cm">* can contain strings specifying the markup for the content of each item to be created, object</span>
<span class="cm">* literals specifying each of the menu item configuration properties, </span>
<span class="cm">* or MenuItem instances. The item content if provided as a string is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.</span>
<span class="cm">* @param {Number} p_nGroupIndex Optional. Number specifying the group to </span>
<span class="cm">* which the items belongs.</span>
<span class="cm">* @return {Array}</span>
<span class="cm">*/</span>
<span class="nx">addItems</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_aItems</span><span class="p">,</span> <span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">nItems</span><span class="p">,</span>
        <span class="nx">aItems</span><span class="p">,</span>
        <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">p_aItems</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">p_aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
        <span class="nx">aItems</span> <span class="o">=</span> <span class="p">[];</span>

        <span class="k">for</span><span class="p">(</span><span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">nItems</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_aItems</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">oItem</span><span class="p">))</span> <span class="p">{</span>
    
                    <span class="nx">aItems</span><span class="p">[</span><span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">]</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">addItems</span><span class="p">(</span><span class="nx">oItem</span><span class="p">,</span> <span class="nx">i</span><span class="p">);</span>
    
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
    
                    <span class="nx">aItems</span><span class="p">[</span><span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">]</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_addItemToGroup</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">oItem</span><span class="p">);</span>
                
                <span class="p">}</span>

            <span class="p">}</span>
    
        <span class="p">}</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">)</span> <span class="p">{</span>
        
            <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">;</span>
        
        <span class="p">}</span>

    <span class="p">}</span>

    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method insertItem</span>
<span class="cm">* @description Inserts an item into the menu at the specified index.</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oItem Object reference for the MenuItem </span>
<span class="cm">* instance to be added to the menu.</span>
<span class="cm">* @param {String} p_oItem String specifying the text of the item to be added </span>
<span class="cm">* to the menu.</span>
<span class="cm">* @param {Object} p_oItem Object literal containing a set of menu item </span>
<span class="cm">* configuration properties.</span>
<span class="cm">* @param {Number} p_nItemIndex Number indicating the ordinal position at which</span>
<span class="cm">* the item should be added.</span>
<span class="cm">* @param {Number} p_nGroupIndex Optional. Number indicating the group to which </span>
<span class="cm">* the item belongs.</span>
<span class="cm">* @return {YAHOO.widget.MenuItem}</span>
<span class="cm">*/</span>
<span class="nx">insertItem</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oItem</span><span class="p">,</span> <span class="nx">p_nItemIndex</span><span class="p">,</span> <span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="p">{</span>
    
    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_addItemToGroup</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">p_oItem</span><span class="p">,</span> <span class="nx">p_nItemIndex</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method removeItem</span>
<span class="cm">* @description Removes the specified item from the menu.</span>
<span class="cm">* @param {YAHOO.widget.MenuItem} p_oObject Object reference for the MenuItem </span>
<span class="cm">* instance to be removed from the menu.</span>
<span class="cm">* @param {Number} p_oObject Number specifying the index of the item </span>
<span class="cm">* to be removed.</span>
<span class="cm">* @param {Number} p_nGroupIndex Optional. Number specifying the group to </span>
<span class="cm">* which the item belongs.</span>
<span class="cm">* @return {YAHOO.widget.MenuItem}</span>
<span class="cm">*/</span>
<span class="nx">removeItem</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_oObject</span><span class="p">,</span> <span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">;</span>
    
    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isUndefined</span><span class="p">(</span><span class="nx">p_oObject</span><span class="p">))</span> <span class="p">{</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">p_oObject</span> <span class="k">instanceof</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">widget</span><span class="p">.</span><span class="nx">MenuItem</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_removeItemFromGroupByValue</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">p_oObject</span><span class="p">);</span>           

        <span class="p">}</span>
        <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">p_oObject</span><span class="p">))</span> <span class="p">{</span>

            <span class="nx">oItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_removeItemFromGroupByIndex</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">,</span> <span class="nx">p_oObject</span><span class="p">);</span>

        <span class="p">}</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oItem</span><span class="p">.</span><span class="nx">destroy</span><span class="p">();</span>

            <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Item removed.&quot;</span> <span class="o">+</span> 
                <span class="s2">&quot; Text: &quot;</span> <span class="o">+</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="s2">&quot;text&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;, &quot;</span> <span class="o">+</span> 
                <span class="s2">&quot; Index: &quot;</span> <span class="o">+</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">index</span> <span class="o">+</span> <span class="s2">&quot;, &quot;</span> <span class="o">+</span> 
                <span class="s2">&quot; Group Index: &quot;</span> <span class="o">+</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">groupIndex</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

            <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">;</span>

        <span class="p">}</span>

    <span class="p">}</span>

    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method getItems</span>
<span class="cm">* @description Returns an array of all of the items in the menu.</span>
<span class="cm">* @return {Array}</span>
<span class="cm">*/</span>
<span class="nx">getItems</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">aGroups</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span><span class="p">,</span>
        <span class="nx">nGroups</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">,</span>
        <span class="nx">aItems</span> <span class="o">=</span> <span class="p">[];</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">aGroups</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">nGroups</span> <span class="o">=</span> <span class="nx">aGroups</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>

        <span class="nx">returnVal</span> <span class="o">=</span> <span class="p">((</span><span class="nx">nGroups</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span> <span class="o">?</span> <span class="nx">aGroups</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">:</span> <span class="p">(</span><span class="nb">Array</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">concat</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">aItems</span><span class="p">,</span> <span class="nx">aGroups</span><span class="p">)));</span>

    <span class="p">}</span>

    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method getItemGroups</span>
<span class="cm">* @description Multi-dimensional Array representing the menu items as they </span>
<span class="cm">* are grouped in the menu.</span>
<span class="cm">* @return {Array}</span>
<span class="cm">*/</span>        
<span class="nx">getItemGroups</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method getItem</span>
<span class="cm">* @description Returns the item at the specified index.</span>
<span class="cm">* @param {Number} p_nItemIndex Number indicating the ordinal position of the </span>
<span class="cm">* item to be retrieved.</span>
<span class="cm">* @param {Number} p_nGroupIndex Optional. Number indicating the group to which </span>
<span class="cm">* the item belongs.</span>
<span class="cm">* @return {YAHOO.widget.MenuItem}</span>
<span class="cm">*/</span>
<span class="nx">getItem</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_nItemIndex</span><span class="p">,</span> <span class="nx">p_nGroupIndex</span><span class="p">)</span> <span class="p">{</span>
    
    <span class="kd">var</span> <span class="nx">aGroup</span><span class="p">,</span>
        <span class="nx">returnVal</span><span class="p">;</span>
    
    <span class="k">if</span> <span class="p">(</span><span class="nx">Lang</span><span class="p">.</span><span class="nx">isNumber</span><span class="p">(</span><span class="nx">p_nItemIndex</span><span class="p">))</span> <span class="p">{</span>

        <span class="nx">aGroup</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_getItemGroup</span><span class="p">(</span><span class="nx">p_nGroupIndex</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">aGroup</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">returnVal</span> <span class="o">=</span> <span class="nx">aGroup</span><span class="p">[</span><span class="nx">p_nItemIndex</span><span class="p">];</span>
        
        <span class="p">}</span>

    <span class="p">}</span>
    
    <span class="k">return</span> <span class="nx">returnVal</span><span class="p">;</span>
    
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method getSubmenus</span>
<span class="cm">* @description Returns an array of all of the submenus that are immediate </span>
<span class="cm">* children of the menu.</span>
<span class="cm">* @return {Array}</span>
<span class="cm">*/</span>
<span class="nx">getSubmenus</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">aItems</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItems</span><span class="p">(),</span>
        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span>
        <span class="nx">aSubmenus</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">,</span>
        <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">nItems</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
        
        <span class="nx">aSubmenus</span> <span class="o">=</span> <span class="p">[];</span>

        <span class="k">for</span><span class="p">(</span><span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">nItems</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
            
            <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

                <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
                
                <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>

                    <span class="nx">aSubmenus</span><span class="p">[</span><span class="nx">aSubmenus</span><span class="p">.</span><span class="nx">length</span><span class="p">]</span> <span class="o">=</span> <span class="nx">oSubmenu</span><span class="p">;</span>

                <span class="p">}</span>
            
            <span class="p">}</span>
        
        <span class="p">}</span>
    
    <span class="p">}</span>

    <span class="k">return</span> <span class="nx">aSubmenus</span><span class="p">;</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method clearContent</span>
<span class="cm">* @description Removes all of the content from the menu, including the menu </span>
<span class="cm">* items, group titles, header and footer.</span>
<span class="cm">*/</span>
<span class="nx">clearContent</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">aItems</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItems</span><span class="p">(),</span>
        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span>
        <span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">element</span><span class="p">,</span>
        <span class="nx">oBody</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">body</span><span class="p">,</span>
        <span class="nx">oHeader</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">header</span><span class="p">,</span>
        <span class="nx">oFooter</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">footer</span><span class="p">,</span>
        <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">;</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">nItems</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">i</span> <span class="o">=</span> <span class="nx">nItems</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>

        <span class="k">do</span> <span class="p">{</span>

            <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

                <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>

                <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>

                    <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">configChangedEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span>
                        <span class="k">this</span><span class="p">.</span><span class="nx">_onParentMenuConfigChange</span><span class="p">,</span> <span class="nx">oSubmenu</span><span class="p">);</span>

                    <span class="k">this</span><span class="p">.</span><span class="nx">renderEvent</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_onParentMenuRender</span><span class="p">,</span> 
                        <span class="nx">oSubmenu</span><span class="p">);</span>

                <span class="p">}</span>
                
                <span class="k">this</span><span class="p">.</span><span class="nx">removeItem</span><span class="p">(</span><span class="nx">oItem</span><span class="p">,</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">groupIndex</span><span class="p">);</span>

            <span class="p">}</span>
        
        <span class="p">}</span>
        <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>

    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oHeader</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Event</span><span class="p">.</span><span class="nx">purgeElement</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">);</span>
        <span class="nx">oElement</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="nx">oHeader</span><span class="p">);</span>

    <span class="p">}</span>
    

    <span class="k">if</span> <span class="p">(</span><span class="nx">oFooter</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Event</span><span class="p">.</span><span class="nx">purgeElement</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">);</span>
        <span class="nx">oElement</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="nx">oFooter</span><span class="p">);</span>
    <span class="p">}</span>


    <span class="k">if</span> <span class="p">(</span><span class="nx">oBody</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">Event</span><span class="p">.</span><span class="nx">purgeElement</span><span class="p">(</span><span class="nx">oBody</span><span class="p">);</span>

        <span class="nx">oBody</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">_EMPTY_STRING</span><span class="p">;</span>

    <span class="p">}</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span> <span class="o">=</span> <span class="p">[];</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span> <span class="o">=</span> <span class="p">[];</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span> <span class="o">=</span> <span class="p">[];</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_WIDTH</span><span class="p">,</span> <span class="kc">null</span><span class="p">);</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method destroy</span>
<span class="cm">* @description Removes the menu&#39;s &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element </span>
<span class="cm">* (and accompanying child nodes) from the document.</span>
<span class="cm">* @param {boolean} shallowPurge If true, only the parent element&#39;s DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners. </span>
<span class="cm">* NOTE: The flag is a &quot;shallowPurge&quot; flag, as opposed to what may be a more intuitive &quot;purgeChildren&quot; flag to maintain backwards compatibility with behavior prior to 2.9.0.</span>
<span class="cm">* </span>
<span class="cm">*/</span>
<span class="nx">destroy</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">shallowPurge</span><span class="p">)</span> <span class="p">{</span>

    <span class="c1">// Remove all items</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">clearContent</span><span class="p">();</span>

    <span class="k">this</span><span class="p">.</span><span class="nx">_aItemGroups</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_aListElements</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
    <span class="k">this</span><span class="p">.</span><span class="nx">_aGroupTitleElements</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>


    <span class="c1">// Continue with the superclass implementation of this method</span>

    <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">destroy</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">shallowPurge</span><span class="p">);</span>
    
    <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Destroyed.&quot;</span><span class="p">,</span> <span class="s2">&quot;info&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method setInitialFocus</span>
<span class="cm">* @description Sets focus to the menu&#39;s first enabled item.</span>
<span class="cm">*/</span>
<span class="nx">setInitialFocus</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_getFirstEnabledItem</span><span class="p">();</span>
    
    <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oItem</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span>

    <span class="p">}</span>
    
<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method setInitialSelection</span>
<span class="cm">* @description Sets the &quot;selected&quot; configuration property of the menu&#39;s first </span>
<span class="cm">* enabled item to &quot;true.&quot;</span>
<span class="cm">*/</span>
<span class="nx">setInitialSelection</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_getFirstEnabledItem</span><span class="p">();</span>
    
    <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
    <span class="p">}</span>        

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method clearActiveItem</span>
<span class="cm">* @description Sets the &quot;selected&quot; configuration property of the menu&#39;s active</span>
<span class="cm">* item to &quot;false&quot; and hides the item&#39;s submenu.</span>
<span class="cm">* @param {Boolean} p_bBlur Boolean indicating if the menu&#39;s active item </span>
<span class="cm">* should be blurred.  </span>
<span class="cm">*/</span>
<span class="nx">clearActiveItem</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_bBlur</span><span class="p">)</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SHOW_DELAY</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
    
        <span class="k">this</span><span class="p">.</span><span class="nx">_cancelShowDelay</span><span class="p">();</span>
    
    <span class="p">}</span>


    <span class="kd">var</span> <span class="nx">oActiveItem</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span><span class="p">,</span>
        <span class="nx">oConfig</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">oActiveItem</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">oConfig</span> <span class="o">=</span> <span class="nx">oActiveItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">p_bBlur</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oActiveItem</span><span class="p">.</span><span class="nx">blur</span><span class="p">();</span>
            
            <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">().</span><span class="nx">_hasFocus</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
        
        <span class="p">}</span>

        <span class="nx">oConfig</span><span class="p">.</span><span class="nx">setProperty</span><span class="p">(</span><span class="nx">_SELECTED</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>

        <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oConfig</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>


        <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>

        <span class="p">}</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">activeItem</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>  

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method focus</span>
<span class="cm">* @description Causes the menu to receive focus and fires the &quot;focus&quot; event.</span>
<span class="cm">*/</span>
<span class="nx">focus</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">hasFocus</span><span class="p">())</span> <span class="p">{</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">setInitialFocus</span><span class="p">();</span>
    
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method blur</span>
<span class="cm">* @description Causes the menu to lose focus and fires the &quot;blur&quot; event.</span>
<span class="cm">*/</span>    
<span class="nx">blur</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oItem</span><span class="p">;</span>

    <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">hasFocus</span><span class="p">())</span> <span class="p">{</span>
    
        <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">MenuManager</span><span class="p">.</span><span class="nx">getFocusedMenuItem</span><span class="p">();</span>
        
        <span class="k">if</span> <span class="p">(</span><span class="nx">oItem</span><span class="p">)</span> <span class="p">{</span>

            <span class="nx">oItem</span><span class="p">.</span><span class="nx">blur</span><span class="p">();</span>

        <span class="p">}</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @method hasFocus</span>
<span class="cm">* @description Returns a boolean indicating whether or not the menu has focus.</span>
<span class="cm">* @return {Boolean}</span>
<span class="cm">*/</span>
<span class="nx">hasFocus</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="k">return</span> <span class="p">(</span><span class="nx">MenuManager</span><span class="p">.</span><span class="nx">getFocusedMenu</span><span class="p">()</span> <span class="o">==</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRoot</span><span class="p">());</span>

<span class="p">},</span>


<span class="nx">_doItemSubmenuSubscribe</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oObject</span><span class="p">)</span> <span class="p">{</span>

    <span class="kd">var</span> <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
        <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>

    <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">oSubmenu</span><span class="p">,</span> <span class="nx">p_oObject</span><span class="p">);</span>
    <span class="p">}</span>

<span class="p">},</span>


<span class="nx">_doSubmenuSubscribe</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">p_sType</span><span class="p">,</span> <span class="nx">p_aArgs</span><span class="p">,</span> <span class="nx">p_oObject</span><span class="p">)</span> <span class="p">{</span> 

    <span class="kd">var</span> <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
    
    <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">oSubmenu</span><span class="p">,</span> <span class="nx">p_oObject</span><span class="p">);</span>
    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* Adds the specified CustomEvent subscriber to the menu and each of </span>
<span class="cm">* its submenus.</span>
<span class="cm">* @method subscribe</span>
<span class="cm">* @param p_type     {string}   the type, or name of the event</span>
<span class="cm">* @param p_fn       {function} the function to exectute when the event fires</span>
<span class="cm">* @param p_obj      {Object}   An object to be passed along when the event </span>
<span class="cm">*                              fires</span>
<span class="cm">* @param p_override {boolean}  If true, the obj passed in becomes the </span>
<span class="cm">*                              execution scope of the listener</span>
<span class="cm">*/</span>
<span class="nx">subscribe</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="c1">//	Subscribe to the event for this Menu instance</span>
    <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>

    <span class="c1">//	Subscribe to the &quot;itemAdded&quot; event so that all future submenus</span>
    <span class="c1">//	also subscribe to this event</span>
    <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">_ITEM_ADDED</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_doItemSubmenuSubscribe</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>


    <span class="kd">var</span> <span class="nx">aItems</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItems</span><span class="p">(),</span>
        <span class="nx">nItems</span><span class="p">,</span>
        <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">;</span>
        

    <span class="k">if</span> <span class="p">(</span><span class="nx">aItems</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
        
        <span class="k">if</span> <span class="p">(</span><span class="nx">nItems</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
        
            <span class="nx">i</span> <span class="o">=</span> <span class="nx">nItems</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>
            
            <span class="k">do</span> <span class="p">{</span>

                <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
                <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
                
                <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">oSubmenu</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">subscribeToConfigEvent</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_doSubmenuSubscribe</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>
                <span class="p">}</span>

            <span class="p">}</span>
            <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>
        
        <span class="p">}</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="nx">unsubscribe</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="c1">//	Remove the event for this Menu instance</span>
    <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>

    <span class="c1">//	Remove the &quot;itemAdded&quot; event so that all future submenus don&#39;t have </span>
    <span class="c1">//	the event handler</span>
    <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">_ITEM_ADDED</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_doItemSubmenuSubscribe</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>


    <span class="kd">var</span> <span class="nx">aItems</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getItems</span><span class="p">(),</span>
        <span class="nx">nItems</span><span class="p">,</span>
        <span class="nx">oItem</span><span class="p">,</span>
        <span class="nx">oSubmenu</span><span class="p">,</span>
        <span class="nx">i</span><span class="p">;</span>
        

    <span class="k">if</span> <span class="p">(</span><span class="nx">aItems</span><span class="p">)</span> <span class="p">{</span>

        <span class="nx">nItems</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
        
        <span class="k">if</span> <span class="p">(</span><span class="nx">nItems</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
        
            <span class="nx">i</span> <span class="o">=</span> <span class="nx">nItems</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>
            
            <span class="k">do</span> <span class="p">{</span>

                <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">aItems</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
                <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">getProperty</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">);</span>
                
                <span class="k">if</span> <span class="p">(</span><span class="nx">oSubmenu</span><span class="p">)</span> <span class="p">{</span>
                    <span class="nx">oSubmenu</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">oSubmenu</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>
                <span class="p">}</span>
                <span class="k">else</span> <span class="p">{</span>
                    <span class="nx">oItem</span><span class="p">.</span><span class="nx">cfg</span><span class="p">.</span><span class="nx">unsubscribeFromConfigEvent</span><span class="p">(</span><span class="nx">_SUBMENU</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_doSubmenuSubscribe</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>
                <span class="p">}</span>

            <span class="p">}</span>
            <span class="k">while</span> <span class="p">(</span><span class="nx">i</span><span class="o">--</span><span class="p">);</span>
        
        <span class="p">}</span>

    <span class="p">}</span>

<span class="p">},</span>


<span class="cm">/**</span>
<span class="cm">* @description Initializes the class&#39;s configurable properties which can be</span>
<span class="cm">* changed using the menu&#39;s Config object (&quot;cfg&quot;).</span>
<span class="cm">* @method initDefaultConfig</span>
<span class="cm">*/</span>
<span class="nx">initDefaultConfig</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>

    <span class="nx">Menu</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">initDefaultConfig</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>

    <span class="kd">var</span> <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cfg</span><span class="p">;</span>


    <span class="c1">// Module documentation overrides</span>

    <span class="cm">/**</span>
<span class="cm">    * @config effect</span>
<span class="cm">    * @description Object or array of objects representing the ContainerEffect </span>
<span class="cm">    * classes that are active for animating the container.  When set this </span>
<span class="cm">    * property is automatically applied to all submenus.</span>
<span class="cm">    * @type Object</span>
<span class="cm">    * @default null</span>
<span class="cm">    */</span>

    <span class="c1">// Overlay documentation overrides</span>


    <span class="cm">/**</span>
<span class="cm">    * @config x</span>
<span class="cm">    * @description Number representing the absolute x-coordinate position of </span>
<span class="cm">    * the Menu.  This property is only applied when the &quot;position&quot; </span>
<span class="cm">    * configuration property is set to dynamic.</span>
<span class="cm">    * @type Number</span>
<span class="cm">    * @default null</span>
<span class="cm">    */</span>
    

    <span class="cm">/**</span>
<span class="cm">    * @config y</span>
<span class="cm">    * @description Number representing the absolute y-coordinate position of </span>
<span class="cm">    * the Menu.  This property is only applied when the &quot;position&quot; </span>
<span class="cm">    * configuration property is set to dynamic.</span>
<span class="cm">    * @type Number</span>
<span class="cm">    * @default null</span>
<span class="cm">    */</span>


    <span class="cm">/**</span>
<span class="cm">    * @description Array of the absolute x and y positions of the Menu.  This </span>
<span class="cm">    * property is only applied when the &quot;position&quot; configuration property is </span>
<span class="cm">    * set to dynamic.</span>
<span class="cm">    * @config xy</span>
<span class="cm">    * @type Number[]</span>
<span class="cm">    * @default null</span>
<span class="cm">    */</span>
    

    <span class="cm">/**</span>
<span class="cm">    * @config context</span>
<span class="cm">    * @description Array of context arguments for context-sensitive positioning.  </span>
<span class="cm">    * The format is: [id or element, element corner, context corner]. </span>
<span class="cm">    * For example, setting this property to [&quot;img1&quot;, &quot;tl&quot;, &quot;bl&quot;] would </span>
<span class="cm">    * align the Menu&#39;s top left corner to the context element&#39;s </span>
<span class="cm">    * bottom left corner.  This property is only applied when the &quot;position&quot; </span>
<span class="cm">    * configuration property is set to dynamic.</span>
<span class="cm">    * @type Array</span>
<span class="cm">    * @default null</span>
<span class="cm">    */</span>
    
    
    <span class="cm">/**</span>
<span class="cm">    * @config fixedcenter</span>
<span class="cm">    * @description Boolean indicating if the Menu should be anchored to the </span>
<span class="cm">    * center of the viewport.  This property is only applied when the </span>
<span class="cm">    * &quot;position&quot; configuration property is set to dynamic.</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    * @default false</span>
<span class="cm">    */</span>
    
    
    <span class="cm">/**</span>
<span class="cm">    * @config iframe</span>
<span class="cm">    * @description Boolean indicating whether or not the Menu should </span>
<span class="cm">    * have an IFRAME shim; used to prevent SELECT elements from </span>
<span class="cm">    * poking through an Overlay instance in IE6.  When set to &quot;true&quot;, </span>
<span class="cm">    * the iframe shim is created when the Menu instance is intially</span>
<span class="cm">    * made visible.  This property is only applied when the &quot;position&quot; </span>
<span class="cm">    * configuration property is set to dynamic and is automatically applied </span>
<span class="cm">    * to all submenus.</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    * @default true for IE6 and below, false for all other browsers.</span>
<span class="cm">    */</span>


    <span class="c1">// Add configuration attributes</span>

    <span class="cm">/*</span>
<span class="cm">        Change the default value for the &quot;visible&quot; configuration </span>
<span class="cm">        property to &quot;false&quot; by re-adding the property.</span>
<span class="cm">    */</span>

    <span class="cm">/**</span>
<span class="cm">    * @config visible</span>
<span class="cm">    * @description Boolean indicating whether or not the menu is visible.  If </span>
<span class="cm">    * the menu&#39;s &quot;position&quot; configuration property is set to &quot;dynamic&quot; (the </span>
<span class="cm">    * default), this property toggles the menu&#39;s &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; </span>
<span class="cm">    * element&#39;s &quot;visibility&quot; style property between &quot;visible&quot; (true) or </span>
<span class="cm">    * &quot;hidden&quot; (false).  If the menu&#39;s &quot;position&quot; configuration property is </span>
<span class="cm">    * set to &quot;static&quot; this property toggles the menu&#39;s </span>
<span class="cm">    * &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element&#39;s &quot;display&quot; style property </span>
<span class="cm">    * between &quot;block&quot; (true) or &quot;none&quot; (false).</span>
<span class="cm">    * @default false</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">VISIBLE_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span>
            <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configVisible</span><span class="p">,</span> 
            <span class="nx">value</span><span class="o">:</span> <span class="nx">VISIBLE_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">VISIBLE_CONFIG</span><span class="p">.</span><span class="nx">validator</span>
        <span class="p">}</span>
     <span class="p">);</span>


    <span class="cm">/*</span>
<span class="cm">        Change the default value for the &quot;constraintoviewport&quot; configuration </span>
<span class="cm">        property (inherited by YAHOO.widget.Overlay) to &quot;true&quot; by re-adding the property.</span>
<span class="cm">    */</span>

    <span class="cm">/**</span>
<span class="cm">    * @config constraintoviewport</span>
<span class="cm">    * @description Boolean indicating if the menu will try to remain inside </span>
<span class="cm">    * the boundaries of the size of viewport.  This property is only applied </span>
<span class="cm">    * when the &quot;position&quot; configuration property is set to dynamic and is </span>
<span class="cm">    * automatically applied to all submenus.</span>
<span class="cm">    * @default true</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">CONSTRAIN_TO_VIEWPORT_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span>
            <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configConstrainToViewport</span><span class="p">,</span> 
            <span class="nx">value</span><span class="o">:</span> <span class="nx">CONSTRAIN_TO_VIEWPORT_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">CONSTRAIN_TO_VIEWPORT_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span> 
            <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">CONSTRAIN_TO_VIEWPORT_CONFIG</span><span class="p">.</span><span class="nx">supercedes</span> 
        <span class="p">}</span> 
    <span class="p">);</span>


    <span class="cm">/*</span>
<span class="cm">        Change the default value for the &quot;preventcontextoverlap&quot; configuration </span>
<span class="cm">        property (inherited by YAHOO.widget.Overlay) to &quot;true&quot; by re-adding the property.</span>
<span class="cm">    */</span>

    <span class="cm">/**</span>
<span class="cm">    * @config preventcontextoverlap</span>
<span class="cm">    * @description Boolean indicating whether or not a submenu should overlap its parent MenuItem </span>
<span class="cm">    * when the &quot;constraintoviewport&quot; configuration property is set to &quot;true&quot;.</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    * @default true</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span><span class="nx">PREVENT_CONTEXT_OVERLAP_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> <span class="p">{</span>

        <span class="nx">value</span><span class="o">:</span> <span class="nx">PREVENT_CONTEXT_OVERLAP_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
        <span class="nx">validator</span><span class="o">:</span> <span class="nx">PREVENT_CONTEXT_OVERLAP_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span> 
        <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">PREVENT_CONTEXT_OVERLAP_CONFIG</span><span class="p">.</span><span class="nx">supercedes</span>

    <span class="p">});</span>


    <span class="cm">/**</span>
<span class="cm">    * @config position</span>
<span class="cm">    * @description String indicating how a menu should be positioned on the </span>
<span class="cm">    * screen.  Possible values are &quot;static&quot; and &quot;dynamic.&quot;  Static menus are </span>
<span class="cm">    * visible by default and reside in the normal flow of the document </span>
<span class="cm">    * (CSS position: static).  Dynamic menus are hidden by default, reside </span>
<span class="cm">    * out of the normal flow of the document (CSS position: absolute), and </span>
<span class="cm">    * can overlay other elements on the screen.</span>
<span class="cm">    * @default dynamic</span>
<span class="cm">    * @type String</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">POSITION_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span>
            <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configPosition</span><span class="p">,</span>
            <span class="nx">value</span><span class="o">:</span> <span class="nx">POSITION_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">POSITION_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
            <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">POSITION_CONFIG</span><span class="p">.</span><span class="nx">supercedes</span>
        <span class="p">}</span>
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config submenualignment</span>
<span class="cm">    * @description Array defining how submenus should be aligned to their </span>
<span class="cm">    * parent menu item. The format is: [itemCorner, submenuCorner]. By default</span>
<span class="cm">    * a submenu&#39;s top left corner is aligned to its parent menu item&#39;s top </span>
<span class="cm">    * right corner.</span>
<span class="cm">    * @default [&quot;tl&quot;,&quot;tr&quot;]</span>
<span class="cm">    * @type Array</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">SUBMENU_ALIGNMENT_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span> 
            <span class="nx">value</span><span class="o">:</span> <span class="nx">SUBMENU_ALIGNMENT_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span>
            <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">SUBMENU_ALIGNMENT_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
        <span class="p">}</span>
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config autosubmenudisplay</span>
<span class="cm">    * @description Boolean indicating if submenus are automatically made </span>
<span class="cm">    * visible when the user mouses over the menu&#39;s items.</span>
<span class="cm">    * @default true</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
       <span class="nx">AUTO_SUBMENU_DISPLAY_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
       <span class="p">{</span> 
           <span class="nx">value</span><span class="o">:</span> <span class="nx">AUTO_SUBMENU_DISPLAY_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
           <span class="nx">validator</span><span class="o">:</span> <span class="nx">AUTO_SUBMENU_DISPLAY_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
           <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">AUTO_SUBMENU_DISPLAY_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
       <span class="p">}</span> 
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config showdelay</span>
<span class="cm">    * @description Number indicating the time (in milliseconds) that should </span>
<span class="cm">    * expire before a submenu is made visible when the user mouses over </span>
<span class="cm">    * the menu&#39;s items.  This property is only applied when the &quot;position&quot; </span>
<span class="cm">    * configuration property is set to dynamic and is automatically applied </span>
<span class="cm">    * to all submenus.</span>
<span class="cm">    * @default 250</span>
<span class="cm">    * @type Number</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
       <span class="nx">SHOW_DELAY_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
       <span class="p">{</span> 
           <span class="nx">value</span><span class="o">:</span> <span class="nx">SHOW_DELAY_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
           <span class="nx">validator</span><span class="o">:</span> <span class="nx">SHOW_DELAY_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
           <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">SHOW_DELAY_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
       <span class="p">}</span> 
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config hidedelay</span>
<span class="cm">    * @description Number indicating the time (in milliseconds) that should </span>
<span class="cm">    * expire before the menu is hidden.  This property is only applied when </span>
<span class="cm">    * the &quot;position&quot; configuration property is set to dynamic and is </span>
<span class="cm">    * automatically applied to all submenus.</span>
<span class="cm">    * @default 0</span>
<span class="cm">    * @type Number</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
       <span class="nx">HIDE_DELAY_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
       <span class="p">{</span> 
           <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configHideDelay</span><span class="p">,</span>
           <span class="nx">value</span><span class="o">:</span> <span class="nx">HIDE_DELAY_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
           <span class="nx">validator</span><span class="o">:</span> <span class="nx">HIDE_DELAY_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span> 
           <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">HIDE_DELAY_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
       <span class="p">}</span> 
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config submenuhidedelay</span>
<span class="cm">    * @description Number indicating the time (in milliseconds) that should </span>
<span class="cm">    * expire before a submenu is hidden when the user mouses out of a menu item </span>
<span class="cm">    * heading in the direction of a submenu.  The value must be greater than or </span>
<span class="cm">    * equal to the value specified for the &quot;showdelay&quot; configuration property.</span>
<span class="cm">    * This property is only applied when the &quot;position&quot; configuration property </span>
<span class="cm">    * is set to dynamic and is automatically applied to all submenus.</span>
<span class="cm">    * @default 250</span>
<span class="cm">    * @type Number</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
       <span class="nx">SUBMENU_HIDE_DELAY_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
       <span class="p">{</span> 
           <span class="nx">value</span><span class="o">:</span> <span class="nx">SUBMENU_HIDE_DELAY_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
           <span class="nx">validator</span><span class="o">:</span> <span class="nx">SUBMENU_HIDE_DELAY_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
           <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">SUBMENU_HIDE_DELAY_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
       <span class="p">}</span> 
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config clicktohide</span>
<span class="cm">    * @description Boolean indicating if the menu will automatically be </span>
<span class="cm">    * hidden if the user clicks outside of it.  This property is only </span>
<span class="cm">    * applied when the &quot;position&quot; configuration property is set to dynamic </span>
<span class="cm">    * and is automatically applied to all submenus.</span>
<span class="cm">    * @default true</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">CLICK_TO_HIDE_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span>
        <span class="p">{</span>
            <span class="nx">value</span><span class="o">:</span> <span class="nx">CLICK_TO_HIDE_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span>
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">CLICK_TO_HIDE_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
            <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">CLICK_TO_HIDE_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
        <span class="p">}</span>
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config container</span>
<span class="cm">    * @description HTML element reference or string specifying the id </span>
<span class="cm">    * attribute of the HTML element that the menu&#39;s markup should be </span>
<span class="cm">    * rendered into.</span>
<span class="cm">    * @type &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="cm">    * level-one-html.html#ID-58190037&quot;&gt;HTMLElement&lt;/a&gt;|String</span>
<span class="cm">    * @default document.body</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
       <span class="nx">CONTAINER_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
       <span class="p">{</span> 
           <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configContainer</span><span class="p">,</span>
           <span class="nx">value</span><span class="o">:</span> <span class="nb">document</span><span class="p">.</span><span class="nx">body</span><span class="p">,</span>
           <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">CONTAINER_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
       <span class="p">}</span> 
   <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config scrollincrement</span>
<span class="cm">    * @description Number used to control the scroll speed of a menu.  Used to </span>
<span class="cm">    * increment the &quot;scrollTop&quot; property of the menu&#39;s body by when a menu&#39;s </span>
<span class="cm">    * content is scrolling.  When set this property is automatically applied </span>
<span class="cm">    * to all submenus.</span>
<span class="cm">    * @default 1</span>
<span class="cm">    * @type Number</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">SCROLL_INCREMENT_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span> 
            <span class="nx">value</span><span class="o">:</span> <span class="nx">SCROLL_INCREMENT_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">SCROLL_INCREMENT_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
            <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">SCROLL_INCREMENT_CONFIG</span><span class="p">.</span><span class="nx">supercedes</span><span class="p">,</span>
            <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">SCROLL_INCREMENT_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
        <span class="p">}</span>
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config minscrollheight</span>
<span class="cm">    * @description Number defining the minimum threshold for the &quot;maxheight&quot; </span>
<span class="cm">    * configuration property.  When set this property is automatically applied </span>
<span class="cm">    * to all submenus.</span>
<span class="cm">    * @default 90</span>
<span class="cm">    * @type Number</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">MIN_SCROLL_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span> 
            <span class="nx">value</span><span class="o">:</span> <span class="nx">MIN_SCROLL_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">MIN_SCROLL_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
            <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">MIN_SCROLL_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">supercedes</span><span class="p">,</span>
            <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">MIN_SCROLL_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
        <span class="p">}</span>
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config maxheight</span>
<span class="cm">    * @description Number defining the maximum height (in pixels) for a menu&#39;s </span>
<span class="cm">    * body element (&lt;code&gt;&amp;#60;div class=&quot;bd&quot;&amp;#62;&lt;/code&gt;).  Once a menu&#39;s body </span>
<span class="cm">    * exceeds this height, the contents of the body are scrolled to maintain </span>
<span class="cm">    * this value.  This value cannot be set lower than the value of the </span>
<span class="cm">    * &quot;minscrollheight&quot; configuration property.</span>
<span class="cm">    * @default 0</span>
<span class="cm">    * @type Number</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
       <span class="nx">MAX_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
       <span class="p">{</span>
            <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configMaxHeight</span><span class="p">,</span>
            <span class="nx">value</span><span class="o">:</span> <span class="nx">MAX_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span>
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">MAX_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
            <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">MAX_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span><span class="p">,</span>
            <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">MAX_HEIGHT_CONFIG</span><span class="p">.</span><span class="nx">supercedes</span>            
       <span class="p">}</span> 
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config classname</span>
<span class="cm">    * @description String representing the CSS class to be applied to the </span>
<span class="cm">    * menu&#39;s root &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element.  The specified class(es)  </span>
<span class="cm">    * are appended in addition to the default class as specified by the menu&#39;s</span>
<span class="cm">    * CSS_CLASS_NAME constant. When set this property is automatically </span>
<span class="cm">    * applied to all submenus.</span>
<span class="cm">    * @default null</span>
<span class="cm">    * @type String</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">CLASS_NAME_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span> 
            <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configClassName</span><span class="p">,</span>
            <span class="nx">value</span><span class="o">:</span> <span class="nx">CLASS_NAME_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">CLASS_NAME_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
            <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">CLASS_NAME_CONFIG</span><span class="p">.</span><span class="nx">supercedes</span>      
        <span class="p">}</span>
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config disabled</span>
<span class="cm">    * @description Boolean indicating if the menu should be disabled.  </span>
<span class="cm">    * Disabling a menu disables each of its items.  (Disabled menu items are </span>
<span class="cm">    * dimmed and will not respond to user input or fire events.)  Disabled</span>
<span class="cm">    * menus have a corresponding &quot;disabled&quot; CSS class applied to their root</span>
<span class="cm">    * &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element.</span>
<span class="cm">    * @default false</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">DISABLED_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span> 
            <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configDisabled</span><span class="p">,</span>
            <span class="nx">value</span><span class="o">:</span> <span class="nx">DISABLED_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">DISABLED_CONFIG</span><span class="p">.</span><span class="nx">validator</span><span class="p">,</span>
            <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">DISABLED_CONFIG</span><span class="p">.</span><span class="nx">suppressEvent</span>
        <span class="p">}</span>
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config shadow</span>
<span class="cm">    * @description Boolean indicating if the menu should have a shadow.</span>
<span class="cm">    * @default true</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">SHADOW_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span> 
            <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">configShadow</span><span class="p">,</span>
            <span class="nx">value</span><span class="o">:</span> <span class="nx">SHADOW_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">SHADOW_CONFIG</span><span class="p">.</span><span class="nx">validator</span>
        <span class="p">}</span>
    <span class="p">);</span>


    <span class="cm">/**</span>
<span class="cm">    * @config keepopen</span>
<span class="cm">    * @description Boolean indicating if the menu should remain open when clicked.</span>
<span class="cm">    * @default false</span>
<span class="cm">    * @type Boolean</span>
<span class="cm">    */</span>
    <span class="nx">oConfig</span><span class="p">.</span><span class="nx">addProperty</span><span class="p">(</span>
        <span class="nx">KEEP_OPEN_CONFIG</span><span class="p">.</span><span class="nx">key</span><span class="p">,</span> 
        <span class="p">{</span> 
            <span class="nx">value</span><span class="o">:</span> <span class="nx">KEEP_OPEN_CONFIG</span><span class="p">.</span><span class="nx">value</span><span class="p">,</span> 
            <span class="nx">validator</span><span class="o">:</span> <span class="nx">KEEP_OPEN_CONFIG</span><span class="p">.</span><span class="nx">validator</span>
        <span class="p">}</span>
    <span class="p">);</span>

<span class="p">}</span>

<span class="p">});</span> <span class="c1">// END YAHOO.lang.extend</span>

<span class="p">})();</span>
</pre></div>

                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div id="moduleList" class="module">
                        <h4>Modules</h4>
                        <ul class="content">
                                <li class=""><a href="module_animation.html" title="animation">animation</a></li>
                                <li class=""><a href="module_autocomplete.html" title="autocomplete">autocomplete</a></li>
                                <li class=""><a href="module_button.html" title="button">button</a></li>
                                <li class=""><a href="module_calendar.html" title="calendar">calendar</a></li>
                                <li class=""><a href="module_carousel.html" title="carousel">carousel</a></li>
                                <li class=""><a href="module_charts.html" title="charts">charts</a></li>
                                <li class=""><a href="module_colorpicker.html" title="colorpicker">colorpicker</a></li>
                                <li class=""><a href="module_connection.html" title="connection">connection</a></li>
                                <li class=""><a href="module_container.html" title="container">container</a></li>
                                <li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
                                <li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
                                <li class=""><a href="module_datatable.html" title="datatable">datatable</a></li>
                                <li class=""><a href="module_datemath.html" title="datemath">datemath</a></li>
                                <li class=""><a href="module_dom.html" title="dom">dom</a></li>
                                <li class=""><a href="module_dragdrop.html" title="dragdrop">dragdrop</a></li>
                                <li class=""><a href="module_editor.html" title="editor">editor</a></li>
                                <li class=""><a href="module_element.html" title="element">element</a></li>
                                <li class=""><a href="module_element-delegate.html" title="element-delegate">element-delegate</a></li>
                                <li class=""><a href="module_event.html" title="event">event</a></li>
                                <li class=""><a href="module_event-delegate.html" title="event-delegate">event-delegate</a></li>
                                <li class=""><a href="module_event-mouseenter.html" title="event-mouseenter">event-mouseenter</a></li>
                                <li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li>
                                <li class=""><a href="module_get.html" title="get">get</a></li>
                                <li class=""><a href="module_history.html" title="history">history</a></li>
                                <li class=""><a href="module_imagecropper.html" title="imagecropper">imagecropper</a></li>
                                <li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
                                <li class=""><a href="module_json.html" title="json">json</a></li>
                                <li class=""><a href="module_layout.html" title="layout">layout</a></li>
                                <li class=""><a href="module_logger.html" title="logger">logger</a></li>
                                <li class="selected"><a href="module_menu.html" title="menu">menu</a></li>
                                <li class=""><a href="module_paginator.html" title="paginator">paginator</a></li>
                                <li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
                                <li class=""><a href="module_profilerviewer.html" title="profilerviewer">profilerviewer</a></li>
                                <li class=""><a href="module_progressbar.html" title="progressbar">progressbar</a></li>
                                <li class=""><a href="module_resize.html" title="resize">resize</a></li>
                                <li class=""><a href="module_selector.html" title="selector">selector</a></li>
                                <li class=""><a href="module_slider.html" title="slider">slider</a></li>
                                <li class=""><a href="module_storage.html" title="Storage">Storage</a></li>
                                <li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
                                <li class=""><a href="module_swf.html" title="swf">swf</a></li>
                                <li class=""><a href="module_swfdetect.html" title="swfdetect">swfdetect</a></li>
                                <li class=""><a href="module_swfstore.html" title="swfstore">swfstore</a></li>
                                <li class=""><a href="module_tabview.html" title="tabview">tabview</a></li>
                                <li class=""><a href="module_treeview.html" title="treeview">treeview</a></li>
                                <li class=""><a href="module_uploader.html" title="uploader">uploader</a></li>
                                <li class=""><a href="module_yahoo.html" title="yahoo">yahoo</a></li>
                                <li class=""><a href="module_yuiloader.html" title="yuiloader">yuiloader</a></li>
                                <li class=""><a href="module_yuitest.html" title="yuitest">yuitest</a></li>
                        </ul>
                    </div>

                    <div id="classList" class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.widget.ContextMenu.html" title="YAHOO.widget.ContextMenu">YAHOO.widget.ContextMenu</a></li>
                                <li class=""><a href="YAHOO.widget.ContextMenuItem.html" title="YAHOO.widget.ContextMenuItem">YAHOO.widget.ContextMenuItem</a></li>
                                <li class=""><a href="YAHOO.widget.Menu.html" title="YAHOO.widget.Menu">YAHOO.widget.Menu</a></li>
                                <li class=""><a href="YAHOO.widget.MenuBar.html" title="YAHOO.widget.MenuBar">YAHOO.widget.MenuBar</a></li>
                                <li class=""><a href="YAHOO.widget.MenuBarItem.html" title="YAHOO.widget.MenuBarItem">YAHOO.widget.MenuBarItem</a></li>
                                <li class=""><a href="YAHOO.widget.MenuItem.html" title="YAHOO.widget.MenuItem">YAHOO.widget.MenuItem</a></li>
                                <li class=""><a href="YAHOO.widget.MenuManager.html" title="YAHOO.widget.MenuManager">YAHOO.widget.MenuManager</a></li>
                        </ul>
                    </div>

                    <div id="fileList" class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="contextmenu.js.html" title="contextmenu.js">contextmenu.js</a></li>
                                <li class=""><a href="contextmenuitem.js.html" title="contextmenuitem.js">contextmenuitem.js</a></li>
                                <li class="selected"><a href="menu.js.html" title="menu.js">menu.js</a></li>
                                <li class=""><a href="menuariaplugin.js.html" title="menuariaplugin.js">menuariaplugin.js</a></li>
                                <li class=""><a href="menubar.js.html" title="menubar.js">menubar.js</a></li>
                                <li class=""><a href="menubaritem.js.html" title="menubaritem.js">menubaritem.js</a></li>
                                <li class=""><a href="menuitem.js.html" title="menuitem.js">menuitem.js</a></li>
                                <li class=""><a href="menumanager.js.html" title="menumanager.js">menumanager.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2011 Yahoo! Inc. All rights reserved.
	</div>
</div>
<script type="text/javascript">

    var ALL_YUI_PROPS = [{"access": "", "host": "YAHOO.widget.Menu", "name": "activeItem", "url": "YAHOO.widget.Menu.html#property_activeItem", "type": "property"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "addClassNameForState", "url": "YAHOO.widget.MenuItem.html#method_addClassNameForState", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "addItem", "url": "YAHOO.widget.Menu.html#method_addItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "addItems", "url": "YAHOO.widget.Menu.html#method_addItems", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_addItemToGroup", "url": "YAHOO.widget.Menu.html#method__addItemToGroup", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "addMenu", "url": "YAHOO.widget.MenuManager.html#method_addMenu", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_addShadowVisibleClass", "url": "YAHOO.widget.Menu.html#method__addShadowVisibleClass", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_aGroupTitleElements", "url": "YAHOO.widget.Menu.html#property__aGroupTitleElements", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_aItemGroups", "url": "YAHOO.widget.Menu.html#property__aItemGroups", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_aListElements", "url": "YAHOO.widget.Menu.html#property__aListElements", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "autosubmenudisplay", "url": "YAHOO.widget.Menu.html#config_autosubmenudisplay", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "autosubmenudisplay", "url": "YAHOO.widget.MenuBar.html#config_autosubmenudisplay", "type": "config"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_bCancelled", "url": "YAHOO.widget.ContextMenu.html#property__bCancelled", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_bHandledMouseOutEvent", "url": "YAHOO.widget.Menu.html#property__bHandledMouseOutEvent", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_bHandledMouseOverEvent", "url": "YAHOO.widget.Menu.html#property__bHandledMouseOverEvent", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "blur", "url": "YAHOO.widget.Menu.html#method_blur", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "blur", "url": "YAHOO.widget.MenuItem.html#method_blur", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "blurEvent", "url": "YAHOO.widget.MenuItem.html#event_blurEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "browser", "url": "YAHOO.widget.MenuItem.html#property_browser", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_bStopMouseEventHandlers", "url": "YAHOO.widget.Menu.html#property__bStopMouseEventHandlers", "type": "property"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "cancel", "url": "YAHOO.widget.ContextMenu.html#method_cancel", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_cancelHideDelay", "url": "YAHOO.widget.Menu.html#method__cancelHideDelay", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_cancelShowDelay", "url": "YAHOO.widget.Menu.html#method__cancelShowDelay", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "checked", "url": "YAHOO.widget.MenuItem.html#config_checked", "type": "config"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "checkPosition", "url": "YAHOO.widget.Menu.html#method_checkPosition", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuBar", "name": "checkPosition", "url": "YAHOO.widget.MenuBar.html#method_checkPosition", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "classname", "url": "YAHOO.widget.Menu.html#config_classname", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "classname", "url": "YAHOO.widget.MenuItem.html#config_classname", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "clearActiveItem", "url": "YAHOO.widget.Menu.html#method_clearActiveItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "clearContent", "url": "YAHOO.widget.Menu.html#method_clearContent", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_clearSetWidthFlag", "url": "YAHOO.widget.Menu.html#method__clearSetWidthFlag", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "clickEvent", "url": "YAHOO.widget.Menu.html#event_clickEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "clickEvent", "url": "YAHOO.widget.MenuItem.html#event_clickEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "clicktohide", "url": "YAHOO.widget.Menu.html#config_clicktohide", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configChecked", "url": "YAHOO.widget.MenuItem.html#method_configChecked", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configClassName", "url": "YAHOO.widget.Menu.html#method_configClassName", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configClassName", "url": "YAHOO.widget.MenuItem.html#method_configClassName", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configContainer", "url": "YAHOO.widget.Menu.html#method_configContainer", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configDisabled", "url": "YAHOO.widget.Menu.html#method_configDisabled", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configDisabled", "url": "YAHOO.widget.MenuItem.html#method_configDisabled", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configEmphasis", "url": "YAHOO.widget.MenuItem.html#method_configEmphasis", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configHelpText", "url": "YAHOO.widget.MenuItem.html#method_configHelpText", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configHideDelay", "url": "YAHOO.widget.Menu.html#method_configHideDelay", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configIframe", "url": "YAHOO.widget.Menu.html#method_configIframe", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configKeyListener", "url": "YAHOO.widget.MenuItem.html#method_configKeyListener", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configMaxHeight", "url": "YAHOO.widget.Menu.html#method_configMaxHeight", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configOnClick", "url": "YAHOO.widget.MenuItem.html#method_configOnClick", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configPosition", "url": "YAHOO.widget.Menu.html#method_configPosition", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configSelected", "url": "YAHOO.widget.MenuItem.html#method_configSelected", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configShadow", "url": "YAHOO.widget.Menu.html#method_configShadow", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configStrongEmphasis", "url": "YAHOO.widget.MenuItem.html#method_configStrongEmphasis", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configSubmenu", "url": "YAHOO.widget.MenuItem.html#method_configSubmenu", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "configSubmenuToggle", "url": "YAHOO.widget.MenuBar.html#method_configSubmenuToggle", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configTarget", "url": "YAHOO.widget.MenuItem.html#method_configTarget", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configText", "url": "YAHOO.widget.MenuItem.html#method_configText", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "configTrigger", "url": "YAHOO.widget.ContextMenu.html#method_configTrigger", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_configureSubmenu", "url": "YAHOO.widget.Menu.html#method__configureSubmenu", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "configURL", "url": "YAHOO.widget.MenuItem.html#method_configURL", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configVisible", "url": "YAHOO.widget.Menu.html#method_configVisible", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "constraintoviewport", "url": "YAHOO.widget.Menu.html#config_constraintoviewport", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "constructor", "url": "YAHOO.widget.MenuItem.html#property_constructor", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "container", "url": "YAHOO.widget.Menu.html#config_container", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "context", "url": "YAHOO.widget.Menu.html#config_context", "type": "config"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "contextEventTarget", "url": "YAHOO.widget.ContextMenu.html#property_contextEventTarget", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_createItemGroup", "url": "YAHOO.widget.Menu.html#method__createItemGroup", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_createKeyListener", "url": "YAHOO.widget.MenuItem.html#method__createKeyListener", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_createRootNodeStructure", "url": "YAHOO.widget.MenuItem.html#method__createRootNodeStructure", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_createShadow", "url": "YAHOO.widget.Menu.html#method__createShadow", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "CSS_CLASS_NAME", "url": "YAHOO.widget.Menu.html#property_CSS_CLASS_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "CSS_CLASS_NAME", "url": "YAHOO.widget.MenuBar.html#property_CSS_CLASS_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuBarItem", "name": "CSS_CLASS_NAME", "url": "YAHOO.widget.MenuBarItem.html#property_CSS_CLASS_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "CSS_CLASS_NAME", "url": "YAHOO.widget.MenuItem.html#property_CSS_CLASS_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuBarItem", "name": "CSS_LABEL_CLASS_NAME", "url": "YAHOO.widget.MenuBarItem.html#property_CSS_LABEL_CLASS_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "CSS_LABEL_CLASS_NAME", "url": "YAHOO.widget.MenuItem.html#property_CSS_LABEL_CLASS_NAME", "type": "property"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "DEFAULT_CONFIG", "url": "YAHOO.widget.ContextMenu.html#property_DEFAULT_CONFIG", "type": "property"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "destroy", "url": "YAHOO.widget.ContextMenu.html#method_destroy", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "destroy", "url": "YAHOO.widget.Menu.html#method_destroy", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "destroy", "url": "YAHOO.widget.MenuItem.html#method_destroy", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "destroyEvent", "url": "YAHOO.widget.MenuItem.html#event_destroyEvent", "type": "event"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_didMouseLeave", "url": "YAHOO.widget.Menu.html#method__didMouseLeave", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "disabled", "url": "YAHOO.widget.Menu.html#config_disabled", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "disabled", "url": "YAHOO.widget.MenuItem.html#config_disabled", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_disableScrollFooter", "url": "YAHOO.widget.Menu.html#method__disableScrollFooter", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_disableScrollHeader", "url": "YAHOO.widget.Menu.html#method__disableScrollHeader", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_dispatchClickEvent", "url": "YAHOO.widget.MenuItem.html#method__dispatchClickEvent", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.MenuItem", "name": "_dispatchDOMClick", "url": "YAHOO.widget.MenuItem.html#method__dispatchDOMClick", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "effect", "url": "YAHOO.widget.Menu.html#config_effect", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "element", "url": "YAHOO.widget.MenuItem.html#property_element", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "emphasis", "url": "YAHOO.widget.MenuItem.html#config_emphasis", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_enableScrollFooter", "url": "YAHOO.widget.Menu.html#method__enableScrollFooter", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_enableScrollHeader", "url": "YAHOO.widget.Menu.html#method__enableScrollHeader", "type": "method"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "EVENT_TYPES", "url": "YAHOO.widget.ContextMenu.html#property_EVENT_TYPES", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_execHideDelay", "url": "YAHOO.widget.Menu.html#method__execHideDelay", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_execSubmenuHideDelay", "url": "YAHOO.widget.Menu.html#method__execSubmenuHideDelay", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "fixedcenter", "url": "YAHOO.widget.Menu.html#config_fixedcenter", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "focus", "url": "YAHOO.widget.Menu.html#method_focus", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "focus", "url": "YAHOO.widget.MenuItem.html#method_focus", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "focusEvent", "url": "YAHOO.widget.MenuItem.html#event_focusEvent", "type": "event"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "getClassNameForState", "url": "YAHOO.widget.MenuItem.html#method_getClassNameForState", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_getFirstEnabledItem", "url": "YAHOO.widget.Menu.html#method__getFirstEnabledItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "getFocusedMenu", "url": "YAHOO.widget.MenuManager.html#method_getFocusedMenu", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "getFocusedMenuItem", "url": "YAHOO.widget.MenuManager.html#method_getFocusedMenuItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getItem", "url": "YAHOO.widget.Menu.html#method_getItem", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_getItemGroup", "url": "YAHOO.widget.Menu.html#method__getItemGroup", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getItemGroups", "url": "YAHOO.widget.Menu.html#method_getItemGroups", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getItems", "url": "YAHOO.widget.Menu.html#method_getItems", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "getMenu", "url": "YAHOO.widget.MenuManager.html#method_getMenu", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "getMenuItem", "url": "YAHOO.widget.MenuManager.html#method_getMenuItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "getMenuItemGroup", "url": "YAHOO.widget.MenuManager.html#method_getMenuItemGroup", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "getMenuRootElement", "url": "YAHOO.widget.MenuManager.html#method_getMenuRootElement", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "getMenus", "url": "YAHOO.widget.MenuManager.html#method_getMenus", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "getNextEnabledSibling", "url": "YAHOO.widget.MenuItem.html#method_getNextEnabledSibling", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "getNextSibling", "url": "YAHOO.widget.MenuItem.html#method_getNextSibling", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "getPreviousEnabledSibling", "url": "YAHOO.widget.MenuItem.html#method_getPreviousEnabledSibling", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "getPreviousSibling", "url": "YAHOO.widget.MenuItem.html#method_getPreviousSibling", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getRoot", "url": "YAHOO.widget.Menu.html#method_getRoot", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getSubmenus", "url": "YAHOO.widget.Menu.html#method_getSubmenus", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "getVisible", "url": "YAHOO.widget.MenuManager.html#method_getVisible", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "groupIndex", "url": "YAHOO.widget.MenuItem.html#property_groupIndex", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "GROUP_TITLE_TAG_NAME", "url": "YAHOO.widget.Menu.html#property_GROUP_TITLE_TAG_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "hasFocus", "url": "YAHOO.widget.Menu.html#method_hasFocus", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "hasFocus", "url": "YAHOO.widget.MenuItem.html#method_hasFocus", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "helptext", "url": "YAHOO.widget.MenuItem.html#config_helptext", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "hidedelay", "url": "YAHOO.widget.Menu.html#config_hidedelay", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "hideVisible", "url": "YAHOO.widget.MenuManager.html#method_hideVisible", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "id", "url": "YAHOO.widget.MenuItem.html#property_id", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "iframe", "url": "YAHOO.widget.Menu.html#config_iframe", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "index", "url": "YAHOO.widget.MenuItem.html#property_index", "type": "property"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "init", "url": "YAHOO.widget.ContextMenu.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "init", "url": "YAHOO.widget.Menu.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "init", "url": "YAHOO.widget.MenuBar.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuBarItem", "name": "init", "url": "YAHOO.widget.MenuBarItem.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "init", "url": "YAHOO.widget.MenuItem.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "initDefaultConfig", "url": "YAHOO.widget.ContextMenu.html#method_initDefaultConfig", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "initDefaultConfig", "url": "YAHOO.widget.Menu.html#method_initDefaultConfig", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "initDefaultConfig", "url": "YAHOO.widget.MenuBar.html#method_initDefaultConfig", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "initDefaultConfig", "url": "YAHOO.widget.MenuItem.html#method_initDefaultConfig", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "initEvents", "url": "YAHOO.widget.ContextMenu.html#method_initEvents", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "initEvents", "url": "YAHOO.widget.Menu.html#method_initEvents", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_initSubTree", "url": "YAHOO.widget.Menu.html#method__initSubTree", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_initSubTree", "url": "YAHOO.widget.MenuItem.html#method__initSubTree", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "insertItem", "url": "YAHOO.widget.Menu.html#method_insertItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "itemAddedEvent", "url": "YAHOO.widget.Menu.html#event_itemAddedEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "itemData", "url": "YAHOO.widget.Menu.html#property_itemData", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "itemRemovedEvent", "url": "YAHOO.widget.Menu.html#event_itemRemovedEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "ITEM_TYPE", "url": "YAHOO.widget.Menu.html#property_ITEM_TYPE", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "keepopen", "url": "YAHOO.widget.Menu.html#config_keepopen", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "keyDownEvent", "url": "YAHOO.widget.Menu.html#event_keyDownEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "keyDownEvent", "url": "YAHOO.widget.MenuItem.html#event_keyDownEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "keylistener", "url": "YAHOO.widget.MenuItem.html#config_keylistener", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "keyPressEvent", "url": "YAHOO.widget.Menu.html#event_keyPressEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "keyPressEvent", "url": "YAHOO.widget.MenuItem.html#event_keyPressEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "keyUpEvent", "url": "YAHOO.widget.Menu.html#event_keyUpEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "keyUpEvent", "url": "YAHOO.widget.MenuItem.html#event_keyUpEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "lazyLoad", "url": "YAHOO.widget.Menu.html#property_lazyLoad", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "maxheight", "url": "YAHOO.widget.Menu.html#config_maxheight", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "minscrollheight", "url": "YAHOO.widget.Menu.html#config_minscrollheight", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "mouseDownEvent", "url": "YAHOO.widget.Menu.html#event_mouseDownEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "mouseDownEvent", "url": "YAHOO.widget.MenuItem.html#event_mouseDownEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "mouseOutEvent", "url": "YAHOO.widget.Menu.html#event_mouseOutEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "mouseOutEvent", "url": "YAHOO.widget.MenuItem.html#event_mouseOutEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "mouseOverEvent", "url": "YAHOO.widget.Menu.html#event_mouseOverEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "mouseOverEvent", "url": "YAHOO.widget.MenuItem.html#event_mouseOverEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "mouseUpEvent", "url": "YAHOO.widget.Menu.html#event_mouseUpEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "mouseUpEvent", "url": "YAHOO.widget.MenuItem.html#event_mouseUpEvent", "type": "event"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_nCurrentMouseX", "url": "YAHOO.widget.Menu.html#property__nCurrentMouseX", "type": "property"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_oAnchor", "url": "YAHOO.widget.MenuItem.html#property__oAnchor", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "OFF_SCREEN_POSITION", "url": "YAHOO.widget.Menu.html#property_OFF_SCREEN_POSITION", "type": "property"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_oHelpTextEM", "url": "YAHOO.widget.MenuItem.html#property__oHelpTextEM", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onBeforeHide", "url": "YAHOO.widget.Menu.html#method__onBeforeHide", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onBeforeRender", "url": "YAHOO.widget.Menu.html#method__onBeforeRender", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onBeforeShow", "url": "YAHOO.widget.Menu.html#method__onBeforeShow", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onBlur", "url": "YAHOO.widget.Menu.html#method__onBlur", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onClick", "url": "YAHOO.widget.Menu.html#method__onClick", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.MenuBar", "name": "_onClick", "url": "YAHOO.widget.MenuBar.html#method__onClick", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "onclick", "url": "YAHOO.widget.MenuItem.html#config_onclick", "type": "config"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "onDOMEvent", "url": "YAHOO.widget.MenuManager.html#method_onDOMEvent", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onHide", "url": "YAHOO.widget.Menu.html#method__onHide", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onInit", "url": "YAHOO.widget.Menu.html#method__onInit", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onItemAdded", "url": "YAHOO.widget.Menu.html#method__onItemAdded", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "onItemAdded", "url": "YAHOO.widget.MenuManager.html#method_onItemAdded", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "onItemDestroy", "url": "YAHOO.widget.MenuManager.html#method_onItemDestroy", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onKeyDown", "url": "YAHOO.widget.Menu.html#method__onKeyDown", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuBar", "name": "_onKeyDown", "url": "YAHOO.widget.MenuBar.html#method__onKeyDown", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onKeyPress", "url": "YAHOO.widget.Menu.html#method__onKeyPress", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "onMenuBlur", "url": "YAHOO.widget.MenuManager.html#method_onMenuBlur", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "onMenuDestroy", "url": "YAHOO.widget.MenuManager.html#method_onMenuDestroy", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "onMenuFocus", "url": "YAHOO.widget.MenuManager.html#method_onMenuFocus", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onMenuItemConfigChange", "url": "YAHOO.widget.Menu.html#method__onMenuItemConfigChange", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onMenuItemDestroy", "url": "YAHOO.widget.Menu.html#method__onMenuItemDestroy", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "onMenuVisibleConfigChange", "url": "YAHOO.widget.MenuManager.html#method_onMenuVisibleConfigChange", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onMouseMove", "url": "YAHOO.widget.Menu.html#method__onMouseMove", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onMouseOut", "url": "YAHOO.widget.Menu.html#method__onMouseOut", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onMouseOver", "url": "YAHOO.widget.Menu.html#method__onMouseOver", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onParentMenuConfigChange", "url": "YAHOO.widget.Menu.html#method__onParentMenuConfigChange", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onParentMenuRender", "url": "YAHOO.widget.Menu.html#method__onParentMenuRender", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onRender", "url": "YAHOO.widget.Menu.html#method__onRender", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onScrollTargetMouseOut", "url": "YAHOO.widget.Menu.html#method__onScrollTargetMouseOut", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onScrollTargetMouseOver", "url": "YAHOO.widget.Menu.html#method__onScrollTargetMouseOver", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onShow", "url": "YAHOO.widget.Menu.html#method__onShow", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_onSubmenuBeforeHide", "url": "YAHOO.widget.MenuItem.html#method__onSubmenuBeforeHide", "type": "method"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_onTriggerClick", "url": "YAHOO.widget.ContextMenu.html#method__onTriggerClick", "type": "method"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_onTriggerContextMenu", "url": "YAHOO.widget.ContextMenu.html#method__onTriggerContextMenu", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onVisibleChange", "url": "YAHOO.widget.Menu.html#method__onVisibleChange", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onYChange", "url": "YAHOO.widget.Menu.html#method__onYChange", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_oOnclickAttributeValue", "url": "YAHOO.widget.MenuItem.html#property__oOnclickAttributeValue", "type": "property"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_oSubmenu", "url": "YAHOO.widget.MenuItem.html#property__oSubmenu", "type": "property"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_oTrigger", "url": "YAHOO.widget.ContextMenu.html#property__oTrigger", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "parent", "url": "YAHOO.widget.Menu.html#property_parent", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "parent", "url": "YAHOO.widget.MenuItem.html#property_parent", "type": "property"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "position", "url": "YAHOO.widget.ContextMenu.html#method_position", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "position", "url": "YAHOO.widget.Menu.html#config_position", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "position", "url": "YAHOO.widget.MenuBar.html#config_position", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "positionOffScreen", "url": "YAHOO.widget.Menu.html#method_positionOffScreen", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "preventcontextoverlap", "url": "YAHOO.widget.Menu.html#config_preventcontextoverlap", "type": "config"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "removeClassNameForState", "url": "YAHOO.widget.MenuItem.html#method_removeClassNameForState", "type": "method"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_removeEventHandlers", "url": "YAHOO.widget.ContextMenu.html#method__removeEventHandlers", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "removeItem", "url": "YAHOO.widget.Menu.html#method_removeItem", "type": "method"}, {"access": "private", "host": "YAHOO.widget.MenuManager", "name": "removeItem", "url": "YAHOO.widget.MenuManager.html#method_removeItem", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_removeItemFromGroupByIndex", "url": "YAHOO.widget.Menu.html#method__removeItemFromGroupByIndex", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_removeItemFromGroupByValue", "url": "YAHOO.widget.Menu.html#method__removeItemFromGroupByValue", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "removeMenu", "url": "YAHOO.widget.MenuManager.html#method_removeMenu", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_removeShadow", "url": "YAHOO.widget.Menu.html#method__removeShadow", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_removeShadowVisibleClass", "url": "YAHOO.widget.Menu.html#method__removeShadowVisibleClass", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_replaceShadow", "url": "YAHOO.widget.Menu.html#method__replaceShadow", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_sClassName", "url": "YAHOO.widget.Menu.html#property__sClassName", "type": "property"}, {"access": "private", "host": "YAHOO.widget.MenuItem", "name": "_sClassName", "url": "YAHOO.widget.MenuItem.html#property__sClassName", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "scrollincrement", "url": "YAHOO.widget.Menu.html#config_scrollincrement", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "selected", "url": "YAHOO.widget.MenuItem.html#config_selected", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "setInitialFocus", "url": "YAHOO.widget.Menu.html#method_setInitialFocus", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "setInitialSelection", "url": "YAHOO.widget.Menu.html#method_setInitialSelection", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "setItemGroupTitle", "url": "YAHOO.widget.Menu.html#method_setItemGroupTitle", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_setMaxHeight", "url": "YAHOO.widget.Menu.html#method__setMaxHeight", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_setScrollHeight", "url": "YAHOO.widget.Menu.html#method__setScrollHeight", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "shadow", "url": "YAHOO.widget.Menu.html#config_shadow", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_shadowBeforeShow", "url": "YAHOO.widget.Menu.html#method__shadowBeforeShow", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "showdelay", "url": "YAHOO.widget.Menu.html#config_showdelay", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_sizeShadow", "url": "YAHOO.widget.Menu.html#method__sizeShadow", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "srcElement", "url": "YAHOO.widget.Menu.html#property_srcElement", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "srcElement", "url": "YAHOO.widget.MenuItem.html#property_srcElement", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_stopMouseEventHandlers", "url": "YAHOO.widget.Menu.html#method__stopMouseEventHandlers", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "strongemphasis", "url": "YAHOO.widget.MenuItem.html#config_strongemphasis", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "submenu", "url": "YAHOO.widget.MenuItem.html#config_submenu", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "submenualignment", "url": "YAHOO.widget.Menu.html#config_submenualignment", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "submenualignment", "url": "YAHOO.widget.MenuBar.html#config_submenualignment", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "submenuhidedelay", "url": "YAHOO.widget.Menu.html#config_submenuhidedelay", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "submenutoggleregion", "url": "YAHOO.widget.MenuBar.html#config_submenutoggleregion", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "SUBMENU_TOGGLE_REGION_WIDTH", "url": "YAHOO.widget.MenuBar.html#property_SUBMENU_TOGGLE_REGION_WIDTH", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "SUBMENU_TYPE", "url": "YAHOO.widget.MenuItem.html#property_SUBMENU_TYPE", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "subscribe", "url": "YAHOO.widget.Menu.html#method_subscribe", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "_subscribeScrollHandlers", "url": "YAHOO.widget.Menu.html#method__subscribeScrollHandlers", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_subscribeToItemEvents", "url": "YAHOO.widget.Menu.html#method__subscribeToItemEvents", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "target", "url": "YAHOO.widget.MenuItem.html#config_target", "type": "config"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "text", "url": "YAHOO.widget.MenuItem.html#config_text", "type": "config"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "toString", "url": "YAHOO.widget.ContextMenu.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "toString", "url": "YAHOO.widget.Menu.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuBar", "name": "toString", "url": "YAHOO.widget.MenuBar.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuBarItem", "name": "toString", "url": "YAHOO.widget.MenuBarItem.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "toString", "url": "YAHOO.widget.MenuItem.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuManager", "name": "toString", "url": "YAHOO.widget.MenuManager.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "trigger", "url": "YAHOO.widget.ContextMenu.html#config_trigger", "type": "config"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "triggerContextMenuEvent", "url": "YAHOO.widget.ContextMenu.html#event_triggerContextMenuEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "_unsubscribeScrollHandlers", "url": "YAHOO.widget.Menu.html#method__unsubscribeScrollHandlers", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_updateItemProperties", "url": "YAHOO.widget.Menu.html#method__updateItemProperties", "type": "method"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "url", "url": "YAHOO.widget.MenuItem.html#config_url", "type": "config"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_useHideDelay", "url": "YAHOO.widget.Menu.html#property__useHideDelay", "type": "property"}, {"access": "", "host": "YAHOO.widget.MenuItem", "name": "value", "url": "YAHOO.widget.MenuItem.html#property_value", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "visible", "url": "YAHOO.widget.Menu.html#config_visible", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "x", "url": "YAHOO.widget.Menu.html#config_x", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "xy", "url": "YAHOO.widget.Menu.html#config_xy", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "y", "url": "YAHOO.widget.Menu.html#config_y", "type": "config"}];
</script>
</body>
</html>
